gcc/testsuite/gcc.dg/Walloca-7.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-Walloca -O0" } */ |
| 3 | |
| 4 | extern void f(void *); |
| 5 | |
| 6 | void foo(void) |
| 7 | { |
| 8 | // Test that strict -Walloca works even without optimization. |
| 9 | f (__builtin_alloca(500)); // { dg-warning "use of 'alloca'" } |
| 10 | } |
| 11 | |
| 12 | void bar(void) |
| 13 | { |
| 14 | // Test that we warn on alloca() calls, not just __builtin_alloca calls. |
| 15 | extern void *alloca(__SIZE_TYPE__); |
| 16 | f (alloca (123)); // { dg-warning "use of 'alloca'" } |
| 17 | } |