| 1 |
/* PR middle-end/94004 - missing -Walloca on calls to alloca due |
| 2 |
to -Wno-system-headers |
| 3 |
{ dg-do compile } |
| 4 |
{ dg-options "-O2 -Wall -Walloca-larger-than=8 -ftrack-macro-expansion=0" } */ |
| 5 |
|
| 6 |
#include "Walloca-larger-than-3.h" |
| 7 |
|
| 8 |
void sink (void*, ...); |
| 9 |
|
| 10 |
void call_builtin_alloca (int n) |
| 11 |
{ |
| 12 |
if (n < 9) |
| 13 |
n = 9; |
| 14 |
void *p = __builtin_alloca (n); // { dg-warning "\\\[-Walloca-larger-than" } |
| 15 |
sink (p, 0); |
| 16 |
} |
| 17 |
|
| 18 |
void call_alloca_sys_hdr (int n) |
| 19 |
{ |
| 20 |
if (n < 9) |
| 21 |
n = 9; |
| 22 |
void *p = alloca (n); // { dg-warning "\\\[-Walloca-larger-than" } |
| 23 |
sink (p, 1); |
| 24 |
} |
| 25 |
|
| 26 |
static inline void inline_call_alloca (int n) |
| 27 |
{ |
| 28 |
if (n > 9) |
| 29 |
n = 9; |
| 30 |
void *p = alloca (n); // { dg-warning "\\\[-Walloca-larger-than" } |
| 31 |
sink (p, 2); |
| 32 |
} |
| 33 |
|
| 34 |
void make_inlined_call (void) |
| 35 |
{ |
| 36 |
inline_call_alloca (10); |
| 37 |
} |