ccf98a5b6690d3af5df90bb39b664ba092d0c4cd
[fw/sdcc] / support / regression / tests / bug-227710.c
1 /* bug-227710.c
2  */
3 #include <testfwk.h>
4
5 static unsigned char _data[] = {
6     1, 2, 3, 4
7 };
8
9 unsigned char *p; 
10
11 struct { 
12     unsigned char index; 
13 } s; 
14
15 static unsigned char 
16 foo(void) 
17
18     // BUG, there will be a PRE-increment 
19     return p[s.index++];
20
21
22 static void
23 testPostIncrement(void)
24 {
25     p = _data;
26     ASSERT(foo() == 1);
27     ASSERT(foo() == 2);
28     ASSERT(foo() == 3);
29     ASSERT(foo() == 4);
30 }