struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr63641.c
blob46d8211a6ead51288b21aeb1ad1033065794826d
1 /*
2 pr63641.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* PR tree-optimization/63641 */
13 int
14 foo (unsigned char b)
16 if (0x0 <= b && b <= 0x8)
17 goto lab;
18 if (b == 0x0b)
19 goto lab;
20 if (0x0e <= b && b <= 0x1a)
21 goto lab;
22 if (0x1c <= b && b <= 0x1f)
23 goto lab;
24 return 0;
25 lab:
26 return 1;
29 int
30 bar (unsigned char b)
32 if (0x0 <= b && b <= 0x8)
33 goto lab;
34 if (b == 0x0b)
35 goto lab;
36 if (0x0e <= b && b <= 0x1a)
37 goto lab;
38 if (0x3c <= b && b <= 0x3f)
39 goto lab;
40 return 0;
41 lab:
42 return 1;
45 #ifndef __SDCC_pdk14 // Lack of memory
46 char tab1[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,
47 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1 };
48 char tab2[] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1,
49 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
50 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
51 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 };
52 #endif
54 void
55 testTortureExecute (void)
57 #ifndef __SDCC_pdk14 // Lack of memory
58 int i;
60 for (i = 0; i < 256; i++)
61 if (foo (i) != (i < 32 ? tab1[i] : 0))
62 ASSERT (0);
63 for (i = 0; i < 256; i++)
64 if (bar (i) != (i < 64 ? tab2[i] : 0))
65 ASSERT (0);
66 return;
67 #endif