Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/Wvla-larger-than-1.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 /* { dg-do compile } */ | |
2 /* { dg-require-effective-target alloca } */ | |
3 /* { dg-options "-Wvla-larger-than=100 -O2" } */ | |
4 | |
5 typedef __SIZE_TYPE__ size_t; | |
6 | |
7 extern void useit (char *); | |
8 | |
9 int num; | |
10 | |
11 void test_vlas (size_t num) | |
12 { | |
13 char str2[num]; /* { dg-warning "unbounded use" } */ | |
14 useit(str2); | |
15 | |
16 num = 98; | |
17 for (int i=0; i < 1234; ++i) { | |
18 char str[num]; // OK, VLA in a loop, but it is a | |
19 // known size *AND* the compiler takes | |
20 // care of cleaning up between | |
21 // iterations with | |
22 // __builtin_stack_restore. | |
23 useit(str); | |
24 } | |
25 } |