libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr110269.c
blobdd5022f3b0cdb794640c83704a16d12d99e7cf80
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-ccp2 -fdump-tree-optimized -fno-ipa-vrp" } */
4 void foo(void);
5 static int a = 1, c;
6 static int *b = &a;
7 static int **d = &b;
8 static int ***e = &d;
9 void __assert_fail() __attribute__((__noreturn__));
10 static int f() {
11 if (a) return a;
12 for (; c;) *e = 0;
13 if (b) __assert_fail();
14 return 6;
16 int main() {
17 if (f()) {
18 *d = 0;
19 if (b == 0)
21 else {
22 __builtin_unreachable();
23 __assert_fail();
26 if (b == 0)
28 else
29 foo();
33 /* { dg-final { scan-tree-dump-times "Folding predicate" 2 "ccp2" } } */
34 /* { dg-final { scan-tree-dump-not "foo" "optimized" } } */