1 /* { dg-do compile } */
2 /* { dg-require-effective-target stdint_types } */
3 /* { dg-require-effective-target alloca } */
4 /* { dg-options "-O2 -Wvla-larger-than=40" } */
14 // 10 * 4 bytes = 40: OK!
25 // 11 * 4 bytes = 44: Not OK.
26 uint32_t x
[a
]; // { dg-warning "array may be too large" }
27 // { dg-message "note:.*argument may be as large as 44" "note" { target *-*-* } .-1 }
33 f3 (__SIZE_TYPE__ a
, __SIZE_TYPE__ b
)
37 // 5 * 3 * 4 bytes = 60: Not OK.
38 uint32_t x
[a
][b
]; // { dg-warning "array may be too large" }
44 f4 (__SIZE_TYPE__ a
, __SIZE_TYPE__ b
)
48 // 5 * 2 * 4 bytes = 40 bytes: OK!
55 f5 (__SIZE_TYPE__ len
)
57 // Test that a direct call to __builtin_alloca_with_align is not
58 // confused with a VLA.
59 void *p
= __builtin_alloca_with_align (len
, 8);
68 char a
[n
]; // { dg-warning "variable-length array is too large" }