Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-2102.c
blob6ec8c0f3402d7f67c6e86a96e0eae20a85b006c8
1 /** bug-2102.c
2 */
3 #include <testfwk.h>
4 #include <stdlib.h>
6 #pragma disable_warning 219
8 struct tst {
9 int a, b;
10 int p[0];
13 void
14 testBug(void)
16 struct tst w[2] = {{0x5555, 0x3333}, {0x1111, 0x2222}}; // will rise warning 219
17 struct tst *p = w; // won't rise warning 219
18 ASSERT (w[1].a == 0x1111);
19 ASSERT (w[1].b == 0x2222);
20 p->p[0] = 0x4444;
21 ASSERT (w[1].a == 0x4444);
22 ASSERT (w[1].b == 0x2222);