libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / Walloca-larger-than.c
blob32ee15ff9ebf385167d3ac7932a0dab5a576f23f
1 /* PR middle-end/82063 - issues with arguments enabled by -Wall
2 { dg-do compile }
3 { dg-require-effective-target alloca }
4 { dg-options "-O2 -Walloca-larger-than=0 -Wvla-larger-than=0 -ftrack-macro-expansion=0" } */
6 extern void* alloca (__SIZE_TYPE__);
8 void sink (void*);
10 #define T(x) sink (x)
12 void test_alloca (void)
14 /* Verify that alloca(0) is diagnosed even if the limit is zero. */
15 T (alloca (0)); /* { dg-warning "argument to .alloca. is zero" } */
16 T (alloca (1)); /* { dg-warning "argument to .alloca. is too large" } */
19 void test_vla (unsigned n)
21 /* VLAs smaller than 32 bytes are optimized into ordinary arrays. */
22 if (n < 1 || 99 < n)
23 n = 1;
25 char a[n]; /* { dg-warning "argument to variable-length array " } */
26 T (a);