ref: 9f15e260cecbb60435e48cc94e64ac0fe3066d4f
parent: 8f56400a286619aa1373e5f731e74a79fb9cdfbc
author: Ori Bernstein <[email protected]>
date: Tue Jul 24 20:37:33 EDT 2012
Make preincs work.
--- a/8/simp.c
+++ b/8/simp.c
@@ -117,8 +117,8 @@
{
Node *n;
- n = mkexpr(a->line, Oload, a, NULL);
assert(a->expr.type->type == Typtr);
+ n = mkexpr(a->line, Oload, a, NULL);
n->expr.type = base(a->expr.type);
return n;
}
@@ -924,14 +924,18 @@
* => args[0] = args[0] + 1
* expr(x) */
case Opreinc:
- t = load(lval(s, args[0]));
- r = store(t, add(t, one));
- lappend(&s->incqueue, &s->nqueue, t);
+ t = rval(s, args[0], NULL);
+ u = lval(s, args[0]);
+ v = store(u, add(t, one));
+ append(s, v);
+ r = rval(s, args[0], NULL);
break;
case Opredec:
- t = load(lval(s, args[0]));
- r = store(t, sub(t, one));
- lappend(&s->incqueue, &s->nqueue, t);
+ t = rval(s, args[0], NULL);
+ u = lval(s, args[0]);
+ v = store(u, add(t, one));
+ append(s, v);
+ r = rval(s, args[0], NULL);
break;
/* expr(x++)