1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3
4
5 __attribute__((noinline))
6 static int
7 test2(int a)
8 {
9 if (__builtin_constant_p (a))
10 __builtin_abort ();
11 return a;
12 }
13 static int
14 test(int *a)
15 {
16 int val = *(volatile int *)a;
17 if (__builtin_constant_p (val))
18 __builtin_abort ();
19 if (val)
20 return test2(val);
21 return 0;
22 }
23 int a;
24 int
25 main()
26 {
27 a = 0;
28 return test (&a);
29 }
30 /* { dg-final { scan-tree-dump "test2" "optimized" } } */