struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bugs-1596270-1736867.c
blob8e06d1c72d6ff36813eb87cb02e0d72207102406
1 /*
2 bugs 1596270 and 1736867.
3 */
5 #include <testfwk.h>
8 typedef unsigned char UINT8;
9 typedef unsigned char S_GAMES_SI_CHARS;
11 typedef struct
13 S_GAMES_SI_CHARS c;
14 UINT8 x, y;
15 }S_GAMES_SI_BLOCK_STRUCT;
16 #define S_GAMES_SI_BLOCK_STRUCT_size sizeof(S_GAMES_SI_BLOCK_STRUCT)
19 static void
20 s_Games_SI_BlockInit(S_GAMES_SI_BLOCK_STRUCT *bl, UINT8
21 i, UINT8 x, UINT8 y)
23 bl[i ].x = x - 1; bl[i ].y = y - 1;
24 bl[i + 1].x = x ; bl[i + 1].y = y - 1;
25 bl[i + 2].x = x + 1;
26 bl[i + 2].y = y - 1;
27 bl[i + 3].x = x - 1; bl[i + 3].y = y ;
28 bl[i + 4].x = x ; bl[i + 4].y = y ;
29 bl[i + 5].x = x + 1; bl[i + 5].y = y ;
30 bl[i + 6].x = x - 1; bl[i + 6].y = y + 1;
31 bl[i + 7].x = x ; bl[i + 7].y = y + 1;
32 bl[i + 8].x = x + 1; bl[i + 8].y = y + 1;
35 void
36 testBug156270(void)
38 #ifndef __SDCC_pdk14 // Lack of memory
39 S_GAMES_SI_BLOCK_STRUCT b[9];
40 s_Games_SI_BlockInit(b, 0, 1, 1);
41 ASSERT(b[1].x == 1); /* 1596270 */
42 ASSERT(b[1].y == 0); /* 1596270 */
43 ASSERT(b[2].x == 2); /* 1596270 */
44 ASSERT(b[2].y == 0); /* 1736867 */
45 #endif