shithub: mc

Download patch

ref: 50087f75b1112f310f5d345f48d50ed286ea8b2b
parent: cd759a0aeddace73edb206608e24c8410b753273
author: Ori Bernstein <[email protected]>
date: Thu Jun 7 07:37:22 EDT 2012

Generate valid slice base calls.

--- a/8/reduce.c
+++ b/8/reduce.c
@@ -327,7 +327,8 @@
         case Tyslice:   u = mkexpr(-1, Oslbase, t, NULL); break;
         default: die("Unslicable type %s", tystr(n->expr.type));
     }
-    sz = tysize(n->expr.args[0]->expr.type->sub[0]);
+    /* safe: all types have a sub[0] that we want to grab */
+    sz = tysize(n->expr.type->sub[0]);
     v = mkexpr(-1, Omul, u, mkexpr(-1, Olit, mkint(-1, sz), NULL));
     return mkexpr(-1, Oadd, u, v, NULL);
 }
@@ -383,6 +384,7 @@
             args[2] = rval(s, args[2]);
             t = mkexpr(-1, Osub, args[2], args[1]);
             args[0] = slicebase(s, args[0], t);
+            r = n;
             break;
         case Oidx:
             t = idxaddr(s, n);