mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-04 08:20:12 +08:00
prevent internal segfault on apparent VLA at file scope
This commit is contained in:
parent
1446b543ae
commit
c85f77de70
2
tccgen.c
2
tccgen.c
@ -3169,6 +3169,8 @@ static void post_type(CType *type, AttributeDef *ad)
|
|||||||
n = vtop->c.i;
|
n = vtop->c.i;
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
error("invalid array size");
|
error("invalid array size");
|
||||||
|
} else if (!local_stack) {
|
||||||
|
error("expected constant expression (variably modified array at file scope)");
|
||||||
} else {
|
} else {
|
||||||
if (!is_integer_btype(vtop->type.t & VT_BTYPE))
|
if (!is_integer_btype(vtop->type.t & VT_BTYPE))
|
||||||
error("size of variable length array should be an integer");
|
error("size of variable length array should be an integer");
|
||||||
|
Loading…
Reference in New Issue
Block a user