diff --git a/tccgen.c b/tccgen.c index e488c65..6aead92 100644 --- a/tccgen.c +++ b/tccgen.c @@ -3174,6 +3174,8 @@ static void post_type(CType *type, AttributeDef *ad) if (n < 0) error("invalid array size"); } else { + if (cur_text_section == NULL) + error("variable length array declared outside of any function"); if (!is_integer_btype(vtop->type.t & VT_BTYPE)) error("size of variable length array should be an integer"); t1 = VT_VLA;