struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug3403429.c
blob5eb0bd42219a12deccfc384b9a71e2ecd99ec49e
1 /*
2 bug3403429.c
3 */
5 #include "testfwk.h"
7 void PTBL (signed char col, signed char row, unsigned char spN)
9 col;
10 row;
11 spN;
14 signed char C [4+1][2+1];
15 unsigned int gm;
17 signed char i;
19 void Sub_9000 (void)
22 unsigned char i, j;
23 for( i=0; i<=36; i+=4 )
25 for( j=0; j<=23; j+=8 )
27 PTBL(i,j,98);
28 PTBL(30-i,20-j,98);
33 if( gm==0 )
35 C[ 1][1]=10; C[ 1][2]=10;
36 C[ 2][1]=10; C[ 2][2]=10;
37 C[ 3][1]=10; C[ 3][2]=10;
38 C[ 4][1]=10; C[ 4][2]=10;
40 for(i=4; i!=0; i--) // <-- BUG IS HERE
42 /* the calculation of the address of C[i] is pulled out of the loop
43 and on top of that the local (out of scope) unsigned char i is used
44 instead of the global signed char i */
45 C[i][1]=0;
46 C[i][2]=0;
51 void testBug(void)
53 unsigned int i;
57 gm = 0;
59 Sub_9000();
61 for(i = 1; i <= 4; i++)
63 ASSERT(C[i][1] == 0);
64 ASSERT(C[i][2] == 0);