1  /* PR middle-end/94004 - missing -Walloca on calls to alloca due
       2     to -Wno-system-headers
       3     { dg-do compile }
       4     { dg-options "-O2 -Wall -Wvla-larger-than=31 -ftrack-macro-expansion=0" }
       5     { dg-require-effective-target alloca } */
       6  
       7  void sink (void*, ...);
       8  
       9  static inline void inline_use_vla (unsigned n)
      10  {
      11    if (n > 32)
      12      n = 32;
      13    char a[n];                  // { dg-warning "\\\[-Wvla-larger-than" }
      14    sink (a, 2);
      15  }
      16  
      17  static inline void use_inlined_vla (unsigned n)
      18  {
      19    inline_use_vla (n);         // this call is okay
      20    inline_use_vla (n + 1);     // this one is not (line 20)
      21  }
      22  
      23  void call_inline (void)
      24  {
      25    use_inlined_vla (31);       // line 25
      26  }
      27  
      28  /* Verify that the inlining context is included and that it points
      29     to the correct line number in the inlined function:
      30     { dg-message "function 'inline_use_vla'.*inlined from 'use_inlined_vla'.*:20:.*inlined from 'call_inline' .*:25:" "" { target *-*-* } 0 }  */