summaryrefslogtreecommitdiff
path: root/6/simp.c
diff options
context:
space:
mode:
Diffstat (limited to '6/simp.c')
-rw-r--r--6/simp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/6/simp.c b/6/simp.c
index d2a9d18..803c5d3 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -1006,6 +1006,15 @@ capture(Simp *s, Node *n, Node *dst)
envsz->expr.type = tyintptr;
assignat(s, e, 0, envsz);
assignat(s, fp, 0, e);
+ } else {
+ /*
+ * We need to zero out the environment, so that
+ * duplicating the function doesn't think we have
+ * a bogus environment.
+ */
+ e = mkintlit(n->loc, 0);
+ e->expr.type = tyintptr;
+ assignat(s, fp, 0, e);
}
assignat(s, fp, Ptrsz, f);
return dst;