Debian Codegraph @

gcc/testsuite/g++.dg/tree-ssa/modref-1.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 struct S { int a; char b[20]; S(); S(S const&); };
4 volatile int global;
5
6 __attribute__ ((noinline,noclone))
7 struct S noescape (int *b)
8 {
9 struct S a;
10 a.a = b!=0;
11 global = 1;
12 return a;
13 }
14
15 void escape (struct S *p);
16
17 __attribute__ ((noinline,noclone))
18 int
19 test(int *b)
20 {
21 struct S s = noescape (b);
22 escape (&s);
23 return *b;
24 }
25 int test2()
26 {
27 int b=1234;
28 test (&b);
29 return b;
30 }
31 // ipa-modref should analyze parameter B of test as noescape.
32 // { dg-final { scan-tree-dump "return 1234" "optimized" } }