PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / Walloca-2.c
blob766ff8d8af39f9e2f8e925d43fa8d98eb7368a5f
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 // FIXME: This is a bogus warning, and is currently happening on
13 // 32-bit targets because VRP is not giving us any range info for
14 // the argument to __builtin_alloca. This should be fixed by the
15 // upcoming range work.
16 p = __builtin_alloca (n); // { dg-bogus "unbounded use of 'alloca'" "" { xfail { ! lp64 } } }
17 else
18 p = __builtin_malloc (n);
19 f (p);
22 void
23 g2 (int n)
25 void *p;
26 if (n < 2000)
27 p = __builtin_alloca (n); // { dg-warning "large due to conversion" }
28 else
29 p = __builtin_malloc (n);
30 f (p);
33 void
34 g3 (int n)
36 void *p;
37 if (n > 0 && n < 3000)
39 p = __builtin_alloca (n); // { dg-warning "'alloca' may be too large" "" { target lp64} }
40 // { dg-message "note:.*argument may be as large as 2999" "note" { target lp64 } .-1 }
41 // { dg-warning "unbounded use of 'alloca'" "" { target { ! lp64 } } .-2 }
43 else
44 p = __builtin_malloc (n);
45 f (p);