summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authoririri <iri@konnichiwastevenspielbergde.su>2018-07-22 01:17:49 -0700
committerOri Bernstein <ori@eigenstate.org>2018-07-22 11:13:25 -0700
commit11d385224d630ae234c7e8c4212cfefac8fd167d (patch)
tree8336f1967a7cdb03e8d1a6252772002110c9a1a8 /6
parent7439e43b38569064395880551b1541db79bcfed5 (diff)
downloadmc-11d385224d630ae234c7e8c4212cfefac8fd167d.tar.gz
Add zeroed env pointer when a const fn is passed as an argument.
This makes it safe to fndup a global function which makes it safe to spawn a global function.
Diffstat (limited to '6')
-rw-r--r--6/simp.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/6/simp.c b/6/simp.c
index 812218c..8bb0d88 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -298,7 +298,7 @@ slicelen(Simp *s, Node *sl)
Node *
loadvar(Simp *s, Node *n, Node *dst)
{
- Node *p, *f, *r;
+ Node *p, *f, *r, *e;
if (isconstfn(n)) {
if (dst)
@@ -308,6 +308,9 @@ loadvar(Simp *s, Node *n, Node *dst)
f = getcode(s, n);
p = addr(s, r, exprtype(n));
assignat(s, p, Ptrsz, f);
+ e = mkintlit(n->loc, 0);
+ e->expr.type = tyintptr;
+ assignat(s, p, 0, e);
} else {
r = n;
}