diff options
author | Jakub Jelinek <jakub@redhat.com> | 2010-07-05 21:42:53 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2010-07-05 21:42:53 +0200 |
commit | 938650d8fddb878f623e315f0b7fd94b217efa96 (patch) | |
tree | be4922c563a29eb1ffb9a15f776a471ae3c9a1ed | |
parent | 0a8c9a137937a9da06119d45370037ce788d7eeb (diff) | |
download | gcc-938650d8fddb878f623e315f0b7fd94b217efa96.zip gcc-938650d8fddb878f623e315f0b7fd94b217efa96.tar.gz gcc-938650d8fddb878f623e315f0b7fd94b217efa96.tar.bz2 |
tree-nrv.c (tree_nrv): Set DECL_VALUE_EXPR on found to result.
* tree-nrv.c (tree_nrv): Set DECL_VALUE_EXPR on found to result.
* gcc.dg/guality/nrv-1.c: New test.
From-SVN: r161849
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/guality/nrv-1.c | 29 | ||||
-rw-r--r-- | gcc/tree-nrv.c | 3 |
4 files changed, 40 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8cf4196..4692a1a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2010-07-05 Jakub Jelinek <jakub@redhat.com> + + * tree-nrv.c (tree_nrv): Set DECL_VALUE_EXPR on found to result. + 2010-07-05 Anatoly Sokolov <aesok@post.ru> * double-int.h (fit_double_type): Remove declaration. @@ -34,7 +38,6 @@ 2010-07-05 Sandra Loosemore <sandra@codesourcery.com> PR middle-end/42505 - * tree-ssa-loop-ivopts.c (determine_set_costs): Delete obsolete comments about cost model. (try_add_cand_for): Add second strategy for choosing initial set diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ae6ec62..2f7e2db 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,7 +1,10 @@ +2010-07-05 Jakub Jelinek <jakub@redhat.com> + + * gcc.dg/guality/nrv-1.c: New test. + 2010-07-05 Sandra Loosemore <sandra@codesourcery.com> PR middle-end/42505 - * gcc.target/arm/pr42505.c: New test case. 2010-07-05 Jakub Jelinek <jakub@redhat.com> diff --git a/gcc/testsuite/gcc.dg/guality/nrv-1.c b/gcc/testsuite/gcc.dg/guality/nrv-1.c new file mode 100644 index 0000000..6e70050 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/nrv-1.c @@ -0,0 +1,29 @@ +/* { dg-do run } */ +/* { dg-options "-g -fno-tree-sra" } */ + +void abort (void); + +struct A +{ + int i[100]; +}; + +struct A a1, a3; + +__attribute__((noinline)) struct A +f () +{ + struct A a2; + a2.i[0] = 42; + if (a3.i[0] != 0) + abort (); + a2.i[4] = 7; /* { dg-final { gdb-test 20 "a2.i\[0\]" "42" } } */ + return a2; +} + +int +main () +{ + a1 = f (); + return 0; +} diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c index 31de9ba..2f40d56 100644 --- a/gcc/tree-nrv.c +++ b/gcc/tree-nrv.c @@ -259,6 +259,9 @@ tree_nrv (void) } } + SET_DECL_VALUE_EXPR (found, result); + DECL_HAS_VALUE_EXPR_P (found) = 1; + /* FOUND is no longer used. Ensure it gets removed. */ var_ann (found)->used = 0; return 0; |