]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/Walloca-10.c
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / Walloca-10.c
1 /* { dg-do compile } */
2 /* { dg-require-effective-target alloca } */
3 /* { dg-options "-Walloca-larger-than=2000 -O2" } */
4
5 // Test when the conditionals are incorrectly reversed.
6
7 void f (void *);
8 void foo (__SIZE_TYPE__ len)
9 {
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);
16 }
17
18 void bar (__SIZE_TYPE__ len)
19 {
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);
26 }