PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr63641.c
blobd08c50b4f14baf07d1db485bfff6f69d6d8c5a32
1 /* PR tree-optimization/63641 */
3 __attribute__ ((noinline, noclone)) int
4 foo (unsigned char b)
6 if (0x0 <= b && b <= 0x8)
7 goto lab;
8 if (b == 0x0b)
9 goto lab;
10 if (0x0e <= b && b <= 0x1a)
11 goto lab;
12 if (0x1c <= b && b <= 0x1f)
13 goto lab;
14 return 0;
15 lab:
16 return 1;
19 __attribute__ ((noinline, noclone)) int
20 bar (unsigned char b)
22 if (0x0 <= b && b <= 0x8)
23 goto lab;
24 if (b == 0x0b)
25 goto lab;
26 if (0x0e <= b && b <= 0x1a)
27 goto lab;
28 if (0x3c <= b && b <= 0x3f)
29 goto lab;
30 return 0;
31 lab:
32 return 1;
35 char tab1[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,
36 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 };
37 char tab2[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,
38 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
39 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 };
42 int
43 main ()
45 int i;
46 asm volatile ("" : : : "memory");
47 for (i = 0; i < 256; i++)
48 if (foo (i) != (i < 32 ? tab1[i] : 0))
49 __builtin_abort ();
50 for (i = 0; i < 256; i++)
51 if (bar (i) != (i < 64 ? tab2[i] : 0))
52 __builtin_abort ();
53 return 0;