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