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