re PR c++/56768 ([4.7] ICE in make_decl_rtl, at varasm.c:1147)

2013-04-02  Richard Biener  <rguenther@suse.de>

	PR middle-end/56768
	Backport from mainline
	2012-05-16  Richard Guenther  <rguenther@suse.de>

	* tree-inline.c (declare_return_variable): Properly handle
	DECL_BY_REFERENCE return vars in SSA form.

	* g++.dg/torture/pr56768.C: New testcase.

From-SVN: r197351
This commit is contained in:
Richard Biener 2013-04-02 12:25:00 +00:00 committed by Richard Biener
parent abe03770e9
commit c57863be4f
4 changed files with 64 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2013-04-02 Richard Biener <rguenther@suse.de>
PR middle-end/56768
Backport from mainline
2012-05-16 Richard Guenther <rguenther@suse.de>
* tree-inline.c (declare_return_variable): Properly handle
DECL_BY_REFERENCE return vars in SSA form.
2013-04-01 Wei Mi <wmi@google.com>
* config/i386/i386.md (*ashl<mode>3_mask): Rewrite as define_insn.

View File

@ -1,3 +1,8 @@
2013-04-02 Richard Biener <rguenther@suse.de>
PR middle-end/56768
* g++.dg/torture/pr56768.C: New testcase.
2013-04-01 Andrey Belevantsev <abel@ispras.ru>
Backport from mainline

View File

@ -0,0 +1,41 @@
// { dg-do compile }
// { dg-options "-std=c++0x" }
struct Iter
{
int& operator* ();
void operator++ ();
};
bool operator!= (Iter &, Iter &) { }
struct Container
{
Iter begin () const;
Iter end () const;
};
struct J
{
virtual J *mutable_child ();
};
struct M
{
M (const Container &);
J ns_;
};
namespace
{
J MakeNamespace (const Container &src)
{
J a;
J *b = 0;
for (const int &c: src)
b = b ? b->mutable_child () : &a;
return a;
}
}
M::M (const Container &ns):ns_ (MakeNamespace (ns))
{
}

View File

@ -2983,10 +2983,15 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest,
if (gimple_in_ssa_p (id->src_cfun))
add_referenced_var (temp);
insert_decl_map (id, result, temp);
/* When RESULT_DECL is in SSA form, we need to use it's default_def
SSA_NAME. */
if (gimple_in_ssa_p (id->src_cfun) && gimple_default_def (id->src_cfun, result))
temp = remap_ssa_name (gimple_default_def (id->src_cfun, result), id);
/* When RESULT_DECL is in SSA form, we need to remap and initialize
it's default_def SSA_NAME. */
if (gimple_in_ssa_p (id->src_cfun)
&& is_gimple_reg (result))
{
temp = make_ssa_name (temp, NULL);
insert_decl_map (id, gimple_default_def (id->src_cfun, result),
temp);
}
insert_init_stmt (id, entry_bb, gimple_build_assign (temp, var));
}
else