diff options
author | Jason Merrill <jason@redhat.com> | 2005-06-24 15:30:20 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2005-06-24 15:30:20 -0400 |
commit | 0620800904747ddbcece61fea155906d3c681e2c (patch) | |
tree | cc1eb57acf77bc335e4ef70031c382fff9d100a1 /gcc/testsuite/gcc.dg/nrv2.c | |
parent | ce91e74c187986865c3de8fbd871242183afa93d (diff) | |
download | gcc-0620800904747ddbcece61fea155906d3c681e2c.zip gcc-0620800904747ddbcece61fea155906d3c681e2c.tar.gz gcc-0620800904747ddbcece61fea155906d3c681e2c.tar.bz2 |
tree-nrv.c (tree_nrv): Fix to check assignments to the RESULT_DECL rather than just RETURN_EXPRs.
* tree-nrv.c (tree_nrv): Fix to check assignments to the
RESULT_DECL rather than just RETURN_EXPRs.
(finalize_nrv_r): Adjust.
From-SVN: r101296
Diffstat (limited to 'gcc/testsuite/gcc.dg/nrv2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/nrv2.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/nrv2.c b/gcc/testsuite/gcc.dg/nrv2.c new file mode 100644 index 0000000..e4d1f9a --- /dev/null +++ b/gcc/testsuite/gcc.dg/nrv2.c @@ -0,0 +1,25 @@ +/* Test that the tree_nrv pass works by making sure that we don't generate + a memcpy. Throw in a bit of control flow to make its job a bit harder. */ + +/* { dg-options "-O" } */ + +struct A { int i[100]; }; + +int b; + +struct A f () +{ + struct A a; + if (b) + { + a.i[0] = 42; + return a; + } + else + { + a.i[42] = 1; + return a; + } +} + +/* { dg-final { scan-assembler-not "memcpy" } } */ |