struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr37924.c
blobb3fc3436ac5214339e953f5c611b7718a05cfb8f
1 /*
2 pr37924.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 c/37924 */
14 signed char a;
15 unsigned char b;
17 #if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && (__GNUC__ < 5 && __GNUC_MINOR__ < 4))
18 int
19 ftest1 (void)
21 int c = -1;
22 return ((unsigned int) (a ^ c)) >> 9;
25 int
26 ftest2 (void)
28 int c = -1;
29 return ((unsigned int) (b ^ c)) >> 9;
31 #endif
33 void
34 testTortureExecute (void)
36 #if !(defined (__GNUC__) && defined (__GNUC_MINOR__) && (__GNUC__ < 5 && __GNUC_MINOR__ < 4))
37 a = 0;
38 if (ftest1 () != (-1U >> 9))
39 ASSERT (0);
40 a = 0x40;
41 if (ftest1 () != (-1U >> 9))
42 ASSERT (0);
43 a = 0x80;
44 if (ftest1 () != (a < 0) ? 0 : (-1U >> 9))
45 ASSERT (0);
46 a = 0xff;
47 if (ftest1 () != (a < 0) ? 0 : (-1U >> 9))
48 ASSERT (0);
49 b = 0;
50 if (ftest2 () != (-1U >> 9))
51 ASSERT (0);
52 b = 0x40;
53 if (ftest2 () != (-1U >> 9))
54 ASSERT (0);
55 b = 0x80;
56 if (ftest2 () != (-1U >> 9))
57 ASSERT (0);
58 b = 0xff;
59 if (ftest2 () != (-1U >> 9))
60 ASSERT (0);
61 return;
62 #endif