struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20080719-1.c
blobaf1124aee9493248ba4bd2ec03036cba1194d8bf
1 /*
2 20080117-1.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 #include <stdint.h>
13 typedef uint32_t u32;
15 static const u32 deadfish = 0xdeadf155;
17 static const u32 cfb_tab8_be[] = {
18 0x00000000,0x000000ff,0x0000ff00,0x0000ffff,
19 0x00ff0000,0x00ff00ff,0x00ffff00,0x00ffffff,
20 0xff000000,0xff0000ff,0xff00ff00,0xff00ffff,
21 0xffff0000,0xffff00ff,0xffffff00,0xffffffff
24 static const u32 cfb_tab8_le[] = {
25 0x00000000,0xff000000,0x00ff0000,0xffff0000,
26 0x0000ff00,0xff00ff00,0x00ffff00,0xffffff00,
27 0x000000ff,0xff0000ff,0x00ff00ff,0xffff00ff,
28 0x0000ffff,0xff00ffff,0x00ffffff,0xffffffff
31 static const u32 cfb_tab16_be[] = {
32 0x00000000, 0x0000ffff, 0xffff0000, 0xffffffff
35 static const u32 cfb_tab16_le[] = {
36 0x00000000, 0xffff0000, 0x0000ffff, 0xffffffff
39 static const u32 cfb_tab32[] = {
40 0x00000000, 0xffffffff
48 const u32 *xxx(int bpp)
50 const u32 *tab;
52 if (0) return &deadfish;
54 switch (bpp) {
55 case 8:
56 tab = cfb_tab8_be;
57 break;
58 case 16:
59 tab = cfb_tab16_be;
60 break;
61 case 32:
62 default:
63 tab = cfb_tab32;
64 break;
67 return tab;
70 void
71 testTortureExecute (void)
73 const u32 *a = xxx(8);
74 int32_t b = a[0];
75 if (b != cfb_tab8_be[0])
76 ASSERT (0);
77 return;