| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=2" } */ |
| 3 |
|
| 4 |
/* Source: Ian Lance Taylor. Dual of no-strict-overflow-6.c. */ |
| 5 |
|
| 6 |
/* VRP test. This turns into an infinite loop (depending on what |
| 7 |
bigtime_test does), but at least we warn about it. */ |
| 8 |
|
| 9 |
extern int bigtime_test (int); |
| 10 |
int |
| 11 |
foo () |
| 12 |
{ |
| 13 |
int j; |
| 14 |
for (j = 1; 0 < j; j *= 2) /* { dg-warning "assuming signed overflow does not occur" "correct warning" { xfail *-*-* } } */ |
| 15 |
if (! bigtime_test (j)) |
| 16 |
return 1; |
| 17 |
return 0; |
| 18 |
} |