Index: src/cmd/8g/cgen.c |
=================================================================== |
--- a/src/cmd/8g/cgen.c |
+++ b/src/cmd/8g/cgen.c |
@@ -562,9 +562,6 @@ |
regfree(&n4); |
} |
- if(w == 0) |
- fatal("index is zero width"); |
- |
// constant index |
if(isconst(nr, CTINT)) { |
if(isconst(nl, CTSTR)) |
@@ -639,7 +636,9 @@ |
gmove(&n1, &n3); |
} |
- if(w == 1 || w == 2 || w == 4 || w == 8) { |
+ if(w == 0) { |
+ // nothing to do |
+ } else if(w == 1 || w == 2 || w == 4 || w == 8) { |
p1 = gins(ALEAL, &n2, &n3); |
p1->from.scale = w; |
p1->from.index = p1->from.type; |
@@ -648,7 +647,6 @@ |
nodconst(&n1, types[TUINT32], w); |
gins(optoas(OMUL, types[TUINT32]), &n1, &n2); |
gins(optoas(OADD, types[tptr]), &n2, &n3); |
- gmove(&n3, res); |
} |
indexdone: |