Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / Wvla-larger-than-1.c
blobf0617f953039e8e63405bf0f65c8fbd65b5f45bc
1 /* { dg-do compile } */
2 /* { dg-require-effective-target alloca } */
3 /* { dg-options "-Wvla-larger-than=100 -O2" } */
5 typedef __SIZE_TYPE__ size_t;
7 extern void useit (char *);
9 int num;
11 void test_vlas (size_t num)
13 char str2[num]; /* { dg-warning "unbounded use" } */
14 useit(str2);
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);