| 1 |
/* PR middle-end/14470. Similar to |
| 2 |
gcc.c-torture/execute/20040313-1.c, but with a compile time test to |
| 3 |
make sure the second if() is removed. */ |
| 4 |
/* Update: We now remove both ifs. Whee. */ |
| 5 |
|
| 6 |
/* { dg-do run } */ |
| 7 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 8 |
|
| 9 |
|
| 10 |
extern void abort(void); |
| 11 |
|
| 12 |
int main() |
| 13 |
{ |
| 14 |
int t[1025] = { 1024 }, d; |
| 15 |
|
| 16 |
d = 0; |
| 17 |
d = t[d]++; |
| 18 |
if (t[0] != 1025) |
| 19 |
abort(); |
| 20 |
if (d != 1024) |
| 21 |
abort(); |
| 22 |
return 0; |
| 23 |
} |
| 24 |
|
| 25 |
/* { dg-final { scan-tree-dump-times "if " 0 "optimized"} } */ |