gcc/testsuite/gcc.dg/Wstrict-overflow-17.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-fstrict-overflow -O2 -Wstrict-overflow" } */ |
| 3 | |
| 4 | /* This erroneously gave an overflow warning. */ |
| 5 | |
| 6 | extern void bar (char); |
| 7 | void |
| 8 | foo (char *s) |
| 9 | { |
| 10 | int len, i; |
| 11 | |
| 12 | for (len = 1; len < 5000; ++len) |
| 13 | { |
| 14 | for (i = 0; i < len; ++i) |
| 15 | { |
| 16 | if (s[i] != '\0') |
| 17 | bar (s[i]); |
| 18 | } |
| 19 | } |
| 20 | } |