Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-2239.c
blobd2c972e7a01c8ffc01a96c3e5c18185adc30890a
1 /*
2 bug-2239.c
3 */
5 #include <testfwk.h>
7 static unsigned short buf[] = {0x8765, 0xa5a5, 0xc3c3, 0xf0f0, 0xabcd};
9 void testBug(void)
11 unsigned char *p = ((unsigned char *) buf) + 4;
12 ASSERT (*((unsigned char *) (p + 2 - 4)) == 0xa5);
13 ASSERT (*((unsigned char *) (p - 2)) == 0xa5);
14 ASSERT (*((unsigned short *) (p + 3 - 7)) == 0x8765);
15 ASSERT (*((unsigned short *) (p - 4)) == 0x8765);
16 ASSERT (*((unsigned char *) (p - 2 + 4)) == 0xf0);
17 ASSERT (*((unsigned char *) (p + 2)) == 0xf0);
18 ASSERT (*((unsigned short *) (p - 3 + 7)) == 0xabcd);
19 ASSERT (*((unsigned short *) (p + 4)) == 0xabcd);