]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/Walloca-larger-than-2.c
[testsuite] Add missing dg-require-effective-target alloca
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / Walloca-larger-than-2.c
1 /* PR middle-end/82063 - issues with arguments enabled by -Wall
2 Verify that alloca() calls in loops are not diagnosed by default.
3 { dg-do compile }
4 { dg-require-effective-target alloca }
5 { dg-options "-O2 -ftrack-macro-expansion=0" } */
6
7 extern void* alloca (__SIZE_TYPE__);
8
9 void sink (void*);
10
11 #define T(x) sink (x)
12
13 void test_alloca (unsigned n)
14 {
15 /* Verify that alloca(0) is not diagnosed in a loop either. */
16 for (unsigned i = 0; i < n; ++i)
17 T (alloca (0));
18
19 /* Verify no warnings for the loops below. */
20 for (unsigned i = 0; i < n; ++i)
21 T (alloca (1));
22
23 for (unsigned i = 1; i < n; ++i)
24 T (alloca (n));
25 }