Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-1898.c
blob22ef2c9ef6328615aa73fe8b182cc99a9740ceb6
1 /*
2 bug-1898.c
3 */
5 #include <testfwk.h>
7 struct tb {
8 char c;
9 short s;
10 int i;
11 } arr[] = {
12 {'a', 1200, 32000},
13 {'b', 1201, 32010},
14 {'c', 1202, 32020},
17 int *g0 = &(arr[1].i);
18 int *g1 = &(arr->i);
19 int *g2 = &((arr + 2)->i);
21 void testBug(void)
23 int *l0 = &(arr[1].i);
24 int *l1 = &(arr->i);
25 int *l2 = &((arr + 2)->i);
27 static int *s0 = &(arr[1].i);
28 static int *s1 = &(arr->i);
29 static int *s2 = &((arr + 2)->i);
31 ASSERT (*g0 == 32010);
32 ASSERT (*g1 == 32000);
33 ASSERT (*g2 == 32020);
35 ASSERT (*l0 == 32010);
36 ASSERT (*l1 == 32000);
37 ASSERT (*l2 == 32020);
39 ASSERT (*s0 == 32010);
40 ASSERT (*s1 == 32000);
41 ASSERT (*s2 == 32020);