diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-09 20:15:17 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-10-09 20:15:17 +0000 |
commit | d7daeaeb94f8d7c416dc6f9fe7950ee112f44017 (patch) | |
tree | ca64d416e627764761b0a356641e582bd975140c | |
parent | fc6ce27c03b66a30e70293d4a4ebed684a5065df (diff) | |
download | gcc-d7daeaeb94f8d7c416dc6f9fe7950ee112f44017.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141010 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 8 | ||||
-rw-r--r-- | libmudflap/ChangeLog | 5 | ||||
-rw-r--r-- | libmudflap/testsuite/libmudflap.c++/pass66-frag.cxx | 17 |
4 files changed, 31 insertions, 5 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index bb4b6b21bed..6ad8a8a6ad5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index b1bbb38dfa8..040a9b10c35 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -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; } diff --git a/libmudflap/ChangeLog b/libmudflap/ChangeLog index b09f9440d5f..9214759b304 100644 --- a/libmudflap/ChangeLog +++ b/libmudflap/ChangeLog @@ -1,3 +1,8 @@ +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> diff --git a/libmudflap/testsuite/libmudflap.c++/pass66-frag.cxx b/libmudflap/testsuite/libmudflap.c++/pass66-frag.cxx new file mode 100644 index 00000000000..989c7ca6f1c --- /dev/null +++ b/libmudflap/testsuite/libmudflap.c++/pass66-frag.cxx @@ -0,0 +1,17 @@ +// PR c++/37568 +// { dg-do compile } +// { dg-options "-fmudflap -O" } + +struct A +{ + int i; +}; + +A +foo () +{ + A a = { 1 }; + return a; +} + +A a = foo (); |