Debian Codegraph @

gcc/testsuite/gcc.dg/nrv2.c

raw
1 /* Test that the tree_nrv pass works by making sure that we don't generate
2 a memcpy. Throw in a bit of control flow to make its job a bit harder. */
3
4 /* { dg-options "-O" } */
5
6 struct A { int i[100]; };
7
8 int b;
9
10 struct A f ()
11 {
12 struct A a;
13 if (b)
14 {
15 a.i[0] = 42;
16 return a;
17 }
18 else
19 {
20 a.i[42] = 1;
21 return a;
22 }
23 }
24
25 /* { dg-final { scan-assembler-not "memcpy" } } */