summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-04-27 18:15:45 -0700
committerOri Bernstein <ori@eigenstate.org>2018-04-27 18:16:17 -0700
commit89331eff71ab876a5b6b534141b1422b2ca42e0b (patch)
tree8172fa0cad3e0a050a18a173dd96de04b89691ac /6
parent32ff704e0db8256cb6535341ae789a15e143745f (diff)
downloadmc-89331eff71ab876a5b6b534141b1422b2ca42e0b.tar.gz
Extract slices recursively.
This fixes deeply nestedl slices of arrays of slices of arrays.
Diffstat (limited to '6')
-rw-r--r--6/blob.c2
-rw-r--r--6/simp.c1
2 files changed, 2 insertions, 1 deletions
diff --git a/6/blob.c b/6/blob.c
index 4c1fa0b..410acab 100644
--- a/6/blob.c
+++ b/6/blob.c
@@ -205,7 +205,7 @@ blobslice(Blob *seq, Htab *globls, Htab *strtab, Node *n)
sz = tysize(tybase(exprtype(base))->sub[0]);
lbl = htget(globls, base);
slbase = mkblobref(lbl, loval*sz, 1);
- } else if (exprop(base) == Olit) {
+ } else if (exprop(base) == Olit || exprop(base) == Oarr) {
slbase = mkblobi(Bti64, getintlit(base, "invalid base expr"));
} else {
fatal(base, "slice base is not a constant value");
diff --git a/6/simp.c b/6/simp.c
index 803c5d3..121dcd5 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -1479,6 +1479,7 @@ extractsub(Simp *s, Node *e)
switch (exprop(e)) {
case Oslice:
sub = e->expr.args[0];
+ extractsub(s, sub);
if (exprop(sub) == Oarr) {
if (sub->expr.nargs > 0) {
e->expr.args[0] = simpblob(s, e->expr.args[0]);