PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / Walloca-10.c
blob6b127cce2a2be9fcc8a6c48c3a6f4b9975c9b0ab
1 /* { dg-do compile } */
2 /* { dg-require-effective-target alloca } */
3 /* { dg-options "-Walloca-larger-than=2000 -O2" } */
5 // Test when the conditionals are incorrectly reversed.
7 void f (void *);
8 void foo (__SIZE_TYPE__ len)
10 void *p;
11 if (len < 500)
12 p = __builtin_malloc (len);
13 else
14 p = __builtin_alloca (len); // { dg-warning "argument to .alloca. may be too large" }
15 f (p);
18 void bar (__SIZE_TYPE__ len)
20 void *p;
21 if (len > 500)
22 p = __builtin_alloca (len); // { dg-warning "argument to .alloca. may be too large" }
23 else
24 p = __builtin_malloc (len);
25 f (p);