struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-930603-3.c
blob3d52864df7e2a6216008f5223513ab6f4cccb938
1 /*
2 930603-3.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 int f (unsigned char *b, int c)
13 unsigned long v = 0;
14 switch (c)
16 case 'd':
17 v = ((unsigned long)b[0] << 8) + b[1];
18 v >>= 9;
19 break;
21 case 'k':
22 v = b[3] >> 4;
23 break;
25 default:
26 ASSERT (0);
29 return v;
31 void
32 testTortureExecute (void)
34 char buf[4];
35 buf[0] = 170; buf[1] = 5;
36 if (f (buf, 'd') != 85)
37 ASSERT (0);
38 return;