prevent internal segfault on apparent VLA at file scope

master
Joe Soroka 2011-04-09 22:59:35 -07:00
parent 1446b543ae
commit c85f77de70
1 changed files with 2 additions and 0 deletions

View File

@ -3169,6 +3169,8 @@ static void post_type(CType *type, AttributeDef *ad)
n = vtop->c.i;
if (n < 0)
error("invalid array size");
} else if (!local_stack) {
error("expected constant expression (variably modified array at file scope)");
} else {
if (!is_integer_btype(vtop->type.t & VT_BTYPE))
error("size of variable length array should be an integer");