diff options
| author | Joe Soroka <gits@joesoroka.com> | 2011-07-22 02:09:28 -0700 |
|---|---|---|
| committer | Joe Soroka <gits@joesoroka.com> | 2011-07-22 02:09:28 -0700 |
| commit | 9b52e16a50e7ed86b4fec6736cd32421fa90785a (patch) | |
| tree | a90b4b7f7f3c9ac7df15c63787b537c1b5907739 /tccgen.c | |
| parent | d7d845888808da6191ab6a70942fac6e3eb815ea (diff) | |
| download | tinycc-9b52e16a50e7ed86b4fec6736cd32421fa90785a.tar.gz tinycc-9b52e16a50e7ed86b4fec6736cd32421fa90785a.tar.bz2 | |
re-added negative-array-size testcase and fixed fix for it
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -3166,13 +3166,13 @@ static void post_type(CType *type, AttributeDef *ad) n = -1; t1 = 0; if (tok != ']') { - gexpr(); + if (!local_stack || nocode_wanted) + vpushi(expr_const()); + else gexpr(); if ((vtop->r & (VT_VALMASK | VT_LVAL | VT_SYM)) == VT_CONST) { 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"); |
