struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20141107-1.c
blob8118496145f5d46a6b76f31dcf26fbfc95ce63ee
1 /*
2 20141107-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 #include <string.h>
13 #define bool _Bool
15 bool f(int a, bool c);
16 bool f(int a, bool c)
18 if (!a)
19 c = !c;
20 return c;
23 void checkf(int a, bool b)
25 bool c = f(a, b);
26 char d;
27 memcpy (&d, &c, 1);
28 #if defined (__SDCC) || (defined(__GNUC__) && !defined(__POWERPC__))
29 if ( d != (a==0)^b)
30 ASSERT(0);
31 #endif
34 void
35 testTortureExecute (void)
37 checkf(0, 0);
38 checkf(0, 1);
39 checkf(1, 1);
40 checkf(1, 0);