Allow global variable array initialziers.
@@ -1440,7 +1440,9 @@ static void simpconstinit(Simp *s, Node *dcl)
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 @@ static void simpconstinit(Simp *s, Node *dcl)
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));
}
