aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Wzero-length-array-bounds-3.c
blob: 9292d182e37bd2463b085ab77e487c8592215d33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* PR tree-optimization/109215 */
/* { dg-do compile } */
/* { dg-options "-O2 -Wall" } */

struct S {};
struct T { struct S s[3]; struct S t; };
void foo (struct S *);

void
bar (struct T *t)
{
  foo (&t->s[2]);	/* { dg-bogus "array subscript 2 is outside the bounds of an interior zero-length array" } */
}

void
baz (struct T *t)
{
  foo (&t->s[3]);	/* { dg-error "" "" { xfail *-*-* } } */
}