Debian Codegraph @

gcc/testsuite/gcc.dg/Wvla-larger-than-4.c

raw
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
6 void sink (void*, ...);
7
8 static inline void inline_use_vla (unsigned n)
9 {
10 if (n > 32)
11 n = 32;
12 char a[n]; // { dg-warning "\\\[-Wvla-larger-than" }
13 sink (a, 2);
14 }
15
16 static inline void use_inlined_vla (unsigned n)
17 {
18 inline_use_vla (n); // this call is okay
19 inline_use_vla (n + 1); // this one is not (line 19)
20 }
21
22 void call_inline (void)
23 {
24 use_inlined_vla (31); // line 24
25 }
26
27 /* Verify that the inlining context is included and that it points
28 to the correct line number in the inlined function:
29 { dg-message "function 'inline_use_vla'.*inlined from 'use_inlined_vla'.*:19:.*inlined from 'call_inline' .*:24:" "" { target *-*-* } 0 } */