shithub: mc

Download patch

ref: a2b0e52ef65d87927a887617898d70aa83feb45c
parent: 2756212aee21eceb8290d4191e7b0aaa88f41485
author: Ori Bernstein <[email protected]>
date: Thu Jul 26 23:12:40 EDT 2012

Make incrementing through a pointer work.

--- a/8/simp.c
+++ b/8/simp.c
@@ -792,8 +792,10 @@
             u = addr(u, exprtype(lhs));
             v = word(lhs->line, size(lhs));
             r = mkexpr(lhs->line, Oblit, t, u, v, NULL);
+        } else if (exprop(lhs) == Ovar) {
+            r = mkexpr(lhs->line, Oset, t, u, NULL);
         } else {
-            r = store(t, u);
+            r = mkexpr(lhs->line, Ostor, t, u, NULL);
         }
     }
     return r;
@@ -948,16 +950,12 @@
          *  => args[0] = args[0] + 1
          *     expr(x) */
         case Opreinc:
-            t = rval(s, args[0], NULL);
-            u = lval(s, args[0]);
-            v = store(u, add(t, one));
+            v = assign(s, args[0], add(args[0], one));
             append(s, v);
             r = rval(s, args[0], NULL);
             break;
         case Opredec:
-            t = rval(s, args[0], NULL);
-            u = lval(s, args[0]);
-            v = store(u, add(t, one));
+            v = assign(s, args[0], sub(args[0], one));
             append(s, v);
             r = rval(s, args[0], NULL);
             break;