aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Warray-bounds-26.c
blob: 85bdb3ea14647e151d3923284506779189ab9c8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* { dg-do compile } */
/* { dg-options "-O2 -Warray-bounds" } */

struct Rec {
  unsigned char data[1];  // actually variable length
};

union U {
  unsigned char buf[42];
  struct Rec rec;
};

int Load()
{
  union U u;
  return u.rec.data[1]; /* { dg-bogus "array bound" } */
}