summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@markovcorp.com>2017-05-19 14:02:53 -0700
committerOri Bernstein <ori@markovcorp.com>2017-05-19 14:02:53 -0700
commitf247b6c460cb00e149434174dbd2b8be32a771e9 (patch)
tree14c6bab8dcb1973b7513ce0d134b5f1daf27794c /6
parentcde6c5f1152664a737ad8fd963ae2d354a07a99e (diff)
downloadmc-f247b6c460cb00e149434174dbd2b8be32a771e9.tar.gz
Allow global variable array initialziers.
Diffstat (limited to '6')
-rw-r--r--6/simp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/6/simp.c b/6/simp.c
index c4aeb5f..d277e22 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -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));
}