aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/countof-zero.c
blob: 27b5bdd490dd11698def0418e30c89babf11f951 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* { dg-do run } */
/* { dg-options "-std=gnu2y" } */

#define assert(e)  ((e) ? (void) 0 : __builtin_abort ())

void
vla (void)
{
  unsigned n;

  n = 0;
  int z[n];
  assert (_Countof (z) == 0);
}

void
matrix_vla (void)
{
  int i;

  i = 0;
  assert (_Countof (int [i++][4]) == 0);
  assert (i == 0 + 1);
}

int
main (void)
{
  vla ();
  matrix_vla ();
}