shithub: mc

Download patch

ref: 7c7208dac215e12376b9d72c7fd52ec4bb44ee69
parent: 8150b8979792892e9c17037262eec2ca12dd3c98
author: Ori Bernstein <[email protected]>
date: Fri Jun 15 00:05:22 EDT 2012

Scale fixed offsets correctly.

--- a/8/isel.c
+++ b/8/isel.c
@@ -279,7 +279,7 @@
     Loc *l, *b, *o; /* location, base, offset */
     int scale;
 
-    scale = 0;
+    scale = 1;
     l = NULL;
     if (exprop(e) == Oadd) {
         args = e->expr.args;
@@ -292,7 +292,7 @@
         if (b->type != Locreg)
             b = inr(s, b);
         if (o->type == Loclit) {
-            l = locmems(o->lit, b, Rnone, scale, m);
+            l = locmem(scale*o->lit, b, Rnone, m);
         } else if (o->type == Locreg) {
             b = inr(s, b);
             l = locmems(0, b, o, scale, m);
@@ -574,7 +574,7 @@
                 fprintf(fd, ",");
                 locprint(fd, l->mem.idx);
             }
-            if (l->mem.scale)
+            if (l->mem.scale > 1)
                 fprintf(fd, ",%d", l->mem.scale);
             if (l->mem.base)
                 fprintf(fd, ")");