struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / bug-3117729.c
blob1ee084e141cb15fd313d059c44d2996782c594b1
1 /*
2 Bug 3117729
3 For
4 x = x + state[i] + pKey[mod_16x8(i, iKeyLen)];
5 an invalid
6 add a,(#_x + 0)
7 was generated.
8 */
11 #include <testfwk.h>
13 #define UCHAR unsigned char
14 #define USHORT unsigned short
16 #define PCHAR unsigned char *
18 #pragma disable_warning 85
20 UCHAR mod_16x8(USHORT s16, UCHAR i8)
22 return (0);
25 #if !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
26 __xdata UCHAR state[256];
27 UCHAR x, y;
29 void swap(PCHAR pa, PCHAR pb)
33 void RC4Init(PCHAR pKey, UCHAR iKeyLen)
35 UCHAR i;
37 i = 0;
40 state[i] = i;
41 i ++;
42 } while (i);
44 x = 0;
47 x = x + state[i] + pKey[mod_16x8(i, iKeyLen)];
48 swap(&state[i], &state[x]);
49 i ++;
50 } while(i);
51 x = 0;
52 y = 0;
54 #endif
56 void
57 testBug(void)
59 ASSERT(1);