struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20120808-1.c
blob18886d1d56c483b3f412e2ae46e088b30df4a5bb
1 /*
2 20120808-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 volatile int i;
12 unsigned char *volatile cp;
13 unsigned char d[32] = { 0 };
15 void
16 testTortureExecute (void)
18 #ifndef __SDCC_pdk14 // Lack of memory
19 unsigned char c[32] = { 0 };
20 unsigned char *p = d + i;
21 int j;
22 for (j = 0; j < 30; j++)
24 int x = 0xff;
25 int y = *++p;
26 switch (j)
28 case 1: x ^= 2; break;
29 case 2: x ^= 4; break;
30 case 25: x ^= 1; break;
31 default: break;
33 c[j] = y | x;
34 cp = p;
36 if (c[0] != 0xff
37 || c[1] != 0xfd
38 || c[2] != 0xfb
39 || c[3] != 0xff
40 || c[4] != 0xff
41 || c[25] != 0xfe
42 || cp != d + 30)
43 ASSERT (0);
44 #endif