Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / Walloca-2.c
blobc81813e0daac79eea6ca7dfb046df820f8edf2b4
1 /* { dg-do compile } */
2 /* { dg-require-effective-target alloca } */
3 /* { dg-options "-Walloca-larger-than=2000 -O2" } */
5 void f (void *);
7 void
8 g1 (int n)
10 void *p;
11 if (n > 0 && n < 2000)
12 p = __builtin_alloca (n); // { dg-bogus "unbounded use of 'alloca'" "" }
13 else
14 p = __builtin_malloc (n);
15 f (p);
18 void
19 g2 (int n)
21 void *p;
22 if (n < 2000)
23 p = __builtin_alloca (n); // { dg-warning "may be too large" }
24 else
25 p = __builtin_malloc (n);
26 f (p);
29 void
30 g3 (int n)
32 void *p;
33 if (n > 0 && n < 3000)
35 p = __builtin_alloca (n); // { dg-warning "may be too large" }
37 else
38 p = __builtin_malloc (n);
39 f (p);