aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/array-4.c
blob: 9396dec3aa7041c3bad6dd47a6b7c3e7f8487b36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* { dg-do run } */
/* { dg-options "" } */

/* Verify that GCC's extension to initialize a zero-length array
   member works properly.  */

extern void abort(void);
extern void exit(int);

struct f { int w; int x[0]; } f = { 4, { 0, 1, 2, 3 } };

int main()
{
  int i;
  for (i = 0; i < f.w; ++i)
    if (f.x[i] != i)
      abort ();
  exit(0);
}