summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-2102.c
blob: 6ec8c0f3402d7f67c6e86a96e0eae20a85b006c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/** bug-2102.c
*/
#include <testfwk.h>
#include <stdlib.h>

#pragma disable_warning 219

struct tst {
  int a, b;
  int p[0];
};

void
testBug(void)
{
  struct tst w[2] = {{0x5555, 0x3333}, {0x1111, 0x2222}}; // will rise warning 219
  struct tst *p = w; // won't rise warning 219
  ASSERT (w[1].a == 0x1111);
  ASSERT (w[1].b == 0x2222);
  p->p[0] = 0x4444;
  ASSERT (w[1].a == 0x4444);
  ASSERT (w[1].b == 0x2222);
}