comparison gcc/testsuite/gcc.dg/Wvla-larger-than-4.c @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
comparison
equal deleted inserted replaced
18:1830386684a0 19:2b5abeee2509
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
21 }
22
23 void call_inline (void)
24 {
25 use_inlined_vla (31);
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 'call_inline' .*:20:" "" { target *-*-* } 0 } */