From c85f77de70fcedc8d3b9e527346921ce980c017d Mon Sep 17 00:00:00 2001 From: Joe Soroka Date: Sat, 9 Apr 2011 22:59:35 -0700 Subject: [PATCH] prevent internal segfault on apparent VLA at file scope --- tccgen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tccgen.c b/tccgen.c index bc9b24f..4baa5ff 100644 --- a/tccgen.c +++ b/tccgen.c @@ -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");