libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / modref-6.c
blob7146389a5b413937b68551a44230c7669452e62a
1 /* { dg-options "-O2 -fdump-tree-modref1 -fdump-tree-optimized" } */
2 /* { dg-do compile } */
3 int c;
4 __attribute__ ((noinline))
5 int *test (int *b)
7 c++;
8 return *b ? &c : 0;
10 __attribute__ ((noinline, pure))
11 int *pure_test (int *b)
13 return *b && c ? &c : 0;
15 __attribute__ ((noinline, const))
16 int *const_test (int *b)
18 return b ? &c : 0;
20 void escape (int *);
22 int test2()
24 int a = 42;
25 escape (test (&a));
26 escape (pure_test (&a));
27 escape (const_test (&a));
28 return a;
30 /* Flags for normal call. */
31 /* { dg-final { scan-tree-dump "parm 0 flags: no_direct_clobber no_indirect_clobber no_direct_escape no_indirect_escape not_returned_directly not_returned_indirectly no_indirect_read" "modref1" } } */
32 /* Flags for pure call. */
33 /* { dg-final { scan-tree-dump "parm 0 flags: not_returned_directly not_returned_indirectly no_indirect_read" "modref1" } } */
34 /* Flags for const call. */
35 /* { dg-final { scan-tree-dump "parm 0 flags: not_returned_directly" "modref1" } } */
36 /* Overall we want to make "int a" non escaping. */
37 /* { dg-final { scan-tree-dump "return 42" "optimized" } } */