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