gcc/testsuite/gcc.dg/Wstrict-overflow-11.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow=1" } */ |
| 3 | |
| 4 | /* Based on strict-overflow-5.c. */ |
| 5 | |
| 6 | /* We can only unroll when using strict overflow semantics. But we |
| 7 | don't issue a warning for relying on undefined overflow in |
| 8 | loops. */ |
| 9 | |
| 10 | int foo (int i) |
| 11 | { |
| 12 | int index; |
| 13 | int r=0; |
| 14 | |
| 15 | for (index = i; index <= i+4; index+=2) |
| 16 | r++; |
| 17 | |
| 18 | return r; |
| 19 | } |