Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(116)

Unified Diff: src/cmd/8g/cgen.c

Issue 4826046: code review 4826046: gc: zero-width struct, zero-length array fixes (Closed)
Patch Set: diff -r 051f7e8b1a7d https://go.googlecode.com/hg/ Created 13 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/cmd/6g/galign.c ('k') | src/cmd/8g/galign.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « src/cmd/6g/galign.c ('k') | src/cmd/8g/galign.c » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b