Split print_rtx into subroutines
[official-gcc.git] / gcc / testsuite / gcc.dg / pr46315.c
blob2349284e2e9cf3ddfbf05f3c0490236a2b5299fb
1 /* PR rtl-optimization/46315 */
2 /* Reported by Magnus Granberg <zorry@gentoo.org> */
4 /* { dg-do run } */
5 /* { dg-options "-O2 -fno-strict-overflow" } */
7 extern void abort (void);
9 static char const *
10 parse_ranged (char const *s, int digits)
12 int n = 0;
13 char const *lim = s + digits;
14 while (s < lim)
16 unsigned d = *s++ - '0';
17 if (9 < d)
18 return 0;
19 n = 10 * n + d;
21 return s && 0 <= n && n <= 59 ? s : 0;
24 int main(void)
26 const char *s = "10092240";
28 s = parse_ranged (s, 2);
29 s = parse_ranged (s, 2);
30 s = parse_ranged (s, 2);
31 s = parse_ranged (s, 2);
33 if (!s || *s != '\0')
34 abort();
36 return 0;