ref: 64a7a7346e02999cf451ee45220b86ba7c69c56f
parent: 49198982626db8548eba7342c259e302af9585f6
author: Ori Bernstein <ori@eigenstate.org>
date: Mon Dec 14 18:56:22 EST 2015
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.
--- a/6/simp.c
+++ b/6/simp.c
@@ -1540,8 +1540,12 @@
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);