(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vla-14.c
       1  /* Test for VLA size evaluation in va_arg.  */
       2  /* Origin: Joseph Myers <joseph@codesourcery.com> */
       3  /* { dg-do run } */
       4  /* { dg-options "-std=gnu99" } */
       5  
       6  #include <stdarg.h>
       7  
       8  extern void exit (int);
       9  extern void abort (void);
      10  
      11  int a[10];
      12  int i = 9;
      13  
      14  void
      15  f (int n, ...)
      16  {
      17    va_list ap;
      18    void *p;
      19    va_start (ap, n);
      20    p = va_arg (ap, typeof (int (*)[++i]));
      21    if (p != a)
      22      abort ();
      23    if (i != n)
      24      abort ();
      25    va_end (ap);
      26  }
      27  
      28  int
      29  main (void)
      30  {
      31    f (10, &a);
      32    exit (0);
      33  }