Commit 2d188530 by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/37568 (ICE returning a struct)

	PR c++/37568
	* semantics.c (finalize_nrv_r): Clear DECL_INITIAL instead of
	setting it to error_mark_node.

	* testsuite/libmudflap.c++/pass66-frag.cxx: New test.

From-SVN: r141010
parent 1692ae7e
2008-10-09 Jakub Jelinek <jakub@redhat.com>
PR c++/37568
* semantics.c (finalize_nrv_r): Clear DECL_INITIAL instead of
setting it to error_mark_node.
2008-10-07 Steve Ellcey <sje@cup.hp.com>
* decl.c (start_cleanup_fn): Declare as inline.
......
......@@ -3310,13 +3310,11 @@ finalize_nrv_r (tree* tp, int* walk_subtrees, void* data)
tree init;
if (DECL_INITIAL (dp->var)
&& DECL_INITIAL (dp->var) != error_mark_node)
{
init = build2 (INIT_EXPR, void_type_node, dp->result,
DECL_INITIAL (dp->var));
DECL_INITIAL (dp->var) = error_mark_node;
}
init = build2 (INIT_EXPR, void_type_node, dp->result,
DECL_INITIAL (dp->var));
else
init = build_empty_stmt ();
DECL_INITIAL (dp->var) = NULL_TREE;
SET_EXPR_LOCUS (init, EXPR_LOCUS (*tp));
*tp = init;
}
......
2008-10-09 Jakub Jelinek <jakub@redhat.com>
PR c++/37568
* testsuite/libmudflap.c++/pass66-frag.cxx: New test.
2008-09-26 Peter O'Gorman <pogma@thewrittenword.com>
Steve Ellcey <sje@cup.hp.com>
......
// PR c++/37568
// { dg-do compile }
// { dg-options "-fmudflap -O" }
struct A
{
int i;
};
A
foo ()
{
A a = { 1 };
return a;
}
A a = foo ();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment