gcc/testsuite/c-c++-common/pr34029-1.c
raw| 1 | static const char s[] = "ab.cd.efghijk"; |
| 2 | |
| 3 | int |
| 4 | foo (const char *x) |
| 5 | { |
| 6 | const char *a; |
| 7 | int b = 0; |
| 8 | |
| 9 | a = __builtin_strchr (s, '.'); |
| 10 | if (a == 0) |
| 11 | b = 1; |
| 12 | else if ((a = __builtin_strchr (a + 1, '.')) == 0) |
| 13 | b = 1; |
| 14 | else if (__builtin_strncmp (s, x, a - s)) |
| 15 | b = 1; |
| 16 | else if (__builtin_strncmp (a + 1, x + (a - s + 1), 4) < 0) |
| 17 | b = 1; |
| 18 | |
| 19 | if (b) |
| 20 | return 4; |
| 21 | return 0; |
| 22 | } |