ref: f247b6c460cb00e149434174dbd2b8be32a771e9
parent: cde6c5f1152664a737ad8fd963ae2d354a07a99e
author: Ori Bernstein <ori@markovcorp.com>
date: Fri May 19 10:02:53 EDT 2017
Allow global variable array initialziers.
--- a/6/simp.c
+++ b/6/simp.c
@@ -1440,7 +1440,9 @@
simpcode(s, e);
else
lappend(&s->blobs, &s->nblobs, dcl);
- } else if (dcl->decl.isconst) {
+ } else if (!dcl->decl.isconst && !e) {
+ lappend(&s->blobs, &s->nblobs, dcl);
+ } else if (e->expr.isconst) {
switch (exprop(e)) {
case Oarr:
case Ostruct:
@@ -1452,8 +1454,6 @@
fatal(dcl, "unsupported initializer for %s", declname(dcl));
break;
}
- } else if (!dcl->decl.isconst && !e) {
- lappend(&s->blobs, &s->nblobs, dcl);
} else {
die("Non-constant initializer for %s\n", declname(dcl));
}