struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr48809.c
blob440d71eb17a8159a81ace3e28f62b014b64fd4cb
1 /*
2 pr48809.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/48809 */
13 int
14 foo (signed char x)
16 int y = 0;
17 switch (x)
19 case 0: y = 1; break;
20 case 1: y = 7; break;
21 case 2: y = 2; break;
22 case 3: y = 19; break;
23 case 4: y = 5; break;
24 case 5: y = 17; break;
25 case 6: y = 31; break;
26 case 7: y = 8; break;
27 case 8: y = 28; break;
28 case 9: y = 16; break;
29 case 10: y = 31; break;
30 case 11: y = 12; break;
31 case 12: y = 15; break;
32 case 13: y = 111; break;
33 case 14: y = 17; break;
34 case 15: y = 10; break;
35 case 16: y = 31; break;
36 case 17: y = 7; break;
37 case 18: y = 2; break;
38 case 19: y = 19; break;
39 case 20: y = 5; break;
40 case 21: y = 107; break;
41 case 22: y = 31; break;
42 case 23: y = 8; break;
43 case 24: y = 28; break;
44 case 25: y = 106; break;
45 case 26: y = 31; break;
46 case 27: y = 102; break;
47 case 28: y = 105; break;
48 case 29: y = 111; break;
49 case 30: y = 17; break;
50 case 31: y = 10; break;
51 case 32: y = 31; break;
52 case 98: y = 18; break;
53 case -62: y = 19; break;
55 return y;
58 void
59 testTortureExecute (void)
61 #if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && (__GNUC__ < 5))
62 if (foo (98) != 18 || foo (97) != 0 || foo (99) != 0)
63 ASSERT (0);
64 if (foo (-62) != 19 || foo (-63) != 0 || foo (-61) != 0)
65 ASSERT (0);
66 if (foo (28) != 105 || foo (27) != 102 || foo (29) != 111)
67 ASSERT (0);
68 return;
69 #endif