summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-12-14 23:56:22 -0800
committerOri Bernstein <ori@eigenstate.org>2015-12-14 23:56:22 -0800
commit64a7a7346e02999cf451ee45220b86ba7c69c56f (patch)
treef3f7bd38dcf22cec27ba497c8ce35d1fc1ae663e
parent49198982626db8548eba7342c259e302af9585f6 (diff)
downloadmc-64a7a7346e02999cf451ee45220b86ba7c69c56f.tar.gz
Don't eliminate side effects on void assign.
The last changes would drop void assignments as they could have no side effects. Unfortunately, this also meant that the side effects of the arguments would be dropped.
-rw-r--r--6/simp.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/6/simp.c b/6/simp.c
index 1f2aee3..862aac8 100644
--- a/6/simp.c
+++ b/6/simp.c
@@ -1540,8 +1540,12 @@ static Node *rval(Simp *s, Node *n, Node *dst)
append(s, mkexpr(n->loc, Oret, NULL));
break;
case Oasn:
- if (tybase(exprtype(n))->type != Tyvoid)
+ if (tybase(exprtype(n))->type == Tyvoid) {
+ if (!ispure(args[1]))
+ r = rval(s, args[1], NULL);
+ } else {
r = assign(s, args[0], args[1]);
+ }
break;
case Ocall:
r = simpcall(s, n, dst);