gcc/testsuite/gcc.dg/Walloca-9.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-Walloca-larger-than=5000 -O2" } */ |
| 3 | |
| 4 | extern void useit(char *); |
| 5 | |
| 6 | int |
| 7 | foobar (unsigned short length) |
| 8 | { |
| 9 | char *pbuf; |
| 10 | __SIZE_TYPE__ size = (__SIZE_TYPE__) length; |
| 11 | |
| 12 | if (size < 4032) |
| 13 | pbuf = (char *) __builtin_alloca(size); |
| 14 | else |
| 15 | pbuf = (char *) __builtin_malloc (size); |
| 16 | |
| 17 | useit(pbuf); |
| 18 | return 0; |
| 19 | } |