Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug3537338.c
blob69b16c0ab971225f623038c4958a632e4f0d66ed
1 /*
2 bug3537338.c
3 */
5 #include <testfwk.h>
7 #if defined (__SDCC)
8 #include <sdcc-lib.h> /* just to get _AUTOMEM or _STATMEM */
9 #else
10 #define _STATMEM
11 #endif
13 int globals[3] = {1, 2, 3};
14 int _STATMEM * ptr = &globals[1];
16 int get_signed(signed char index)
18 return *(ptr+index);
21 int get_signedi(int index)
23 return *(ptr+index);
26 int get_unsigned(unsigned char index)
28 return *(ptr+index);
31 void testBug(void)
33 #ifndef __SDCC_pic16
34 ASSERT (get_signed(-1) == globals[0]);
35 ASSERT (get_signedi(-1) == globals[0]);
36 ASSERT (get_signed(1) == globals[2]);
37 ASSERT (get_unsigned(1) == globals[2]);
38 #endif