| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -fdump-tree-ccp2 -fdump-tree-optimized -fno-ipa-vrp" } */ |
| 3 |
|
| 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; |
| 15 |
} |
| 16 |
int main() { |
| 17 |
if (f()) { |
| 18 |
*d = 0; |
| 19 |
if (b == 0) |
| 20 |
; |
| 21 |
else { |
| 22 |
__builtin_unreachable(); |
| 23 |
__assert_fail(); |
| 24 |
} |
| 25 |
} |
| 26 |
if (b == 0) |
| 27 |
; |
| 28 |
else |
| 29 |
foo(); |
| 30 |
; |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-final { scan-tree-dump-times "Folding predicate" 2 "ccp2" } } */ |
| 34 |
/* { dg-final { scan-tree-dump-not "foo" "optimized" } } */ |