struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-2181.c
blobfeb02a212673aeea84460f6533d87356f6a0dcc8
1 /*
2 bug 2181
3 */
5 #include <testfwk.h>
7 #include <string.h>
9 #if !defined( __SDCC_mcs51) && !defined( __SDCC_pdk15) // Use shorter array for devices with low memory.
10 #define SROWLENGTH 36
11 #else
12 #define SROWLENGTH 6
13 #endif
15 #ifndef __SDCC_pdk14 // Not enough memory
16 unsigned char a[2][4][SROWLENGTH];
18 void f(void)
20 unsigned char i;
22 for(i = 0; i < 4; i++)
23 memset(a[0][i], 144 + i * 32, SROWLENGTH);
25 #endif
27 void testBug(void)
29 #ifndef __SDCC_pdk14 // Not enough memory
30 f();
31 ASSERT (a[0][0][0] == 144 + 0 * 32);
32 ASSERT (a[0][0][SROWLENGTH - 1] == 144 + 0 * 32);
33 ASSERT (a[0][3][0] == 144 + 3 * 32);
34 ASSERT (a[0][3][SROWLENGTH - 1] == 144 + 3 * 32);
35 #endif