aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Soroka <gits@joesoroka.com>2011-04-09 22:59:35 -0700
committerJoe Soroka <gits@joesoroka.com>2011-04-09 22:59:35 -0700
commitc85f77de70fcedc8d3b9e527346921ce980c017d (patch)
tree29015f66beb40cee9c9cc489ecd57f1513a83043
parent1446b543ae54643d904c15525fa75ab580b9ea23 (diff)
downloadtinycc-c85f77de70fcedc8d3b9e527346921ce980c017d.tar.gz
tinycc-c85f77de70fcedc8d3b9e527346921ce980c017d.tar.bz2
prevent internal segfault on apparent VLA at file scope
-rw-r--r--tccgen.c2
1 files changed, 2 insertions, 0 deletions
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");