summaryrefslogtreecommitdiff
path: root/6/simp.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-12-11 22:20:11 -0800
committerOri Bernstein <ori@eigenstate.org>2015-12-11 22:20:11 -0800
commite9a476ebae14c3d6a806bddc1b7514b60a846fc4 (patch)
tree3ef4b7eb6e6b609d04e872b9e81887bc669512a5 /6/simp.c
parentd21cc40703f9e3fb86e590fce62ee0847fc6cfd8 (diff)
downloadmc-e9a476ebae14c3d6a806bddc1b7514b60a846fc4.tar.gz
Fix code to disallow use before definition.
At least in some cases.
Diffstat (limited to '6/simp.c')
-rw-r--r--6/simp.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/6/simp.c b/6/simp.c
index 59a12e9..03ad0b1 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -963,6 +963,10 @@ static Node *assign(Simp *s, Node *lhs, Node *rhs)
t = lval(s, lhs);
u = rval(s, rhs, t);
+ /* hack: we're assigning to lhs, but blitting shit over doesn't
+ * trigger that */
+ if (stacknode(lhs))
+ def(s, lhs);
/* if we stored the result into t, rval() should return that,
* so we know our work is done. */
if (u == t) {