aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-04-25 12:08:48 -0400
committerRuss Cox <rsc@golang.org>2011-04-25 12:08:48 -0400
commit3a1fdc655e40a9b3f27734ca950139ffcfb54e0b (patch)
treefa7e7192a89c79b3701c75db5ff8dbf616807854 /src
parent883d68f885750806ca9a244ed1c19db58a971ab7 (diff)
downloadgo-3a1fdc655e40a9b3f27734ca950139ffcfb54e0b.tar.xz
gc: fix import width bug
Fixes #1705. R=ken2 CC=golang-dev https://golang.org/cl/4443060
Diffstat (limited to 'src')
-rw-r--r--src/cmd/5g/cgen.c2
-rw-r--r--src/cmd/6g/cgen.c2
-rw-r--r--src/cmd/8g/cgen.c2
-rw-r--r--src/cmd/gc/dcl.c4
-rw-r--r--src/cmd/gc/walk.c4
5 files changed, 13 insertions, 1 deletions
diff --git a/src/cmd/5g/cgen.c b/src/cmd/5g/cgen.c
index 032409baee..e0fc768215 100644
--- a/src/cmd/5g/cgen.c
+++ b/src/cmd/5g/cgen.c
@@ -43,6 +43,8 @@ cgen(Node *n, Node *res)
}
if(isfat(n->type)) {
+ if(n->type->width < 0)
+ fatal("forgot to compute width for %T", n->type);
sgen(n, res, n->type->width);
goto ret;
}
diff --git a/src/cmd/6g/cgen.c b/src/cmd/6g/cgen.c
index 47f3374f53..048174e086 100644
--- a/src/cmd/6g/cgen.c
+++ b/src/cmd/6g/cgen.c
@@ -47,6 +47,8 @@ cgen(Node *n, Node *res)
}
if(isfat(n->type)) {
+ if(n->type->width < 0)
+ fatal("forgot to compute width for %T", n->type);
sgen(n, res, n->type->width);
goto ret;
}
diff --git a/src/cmd/8g/cgen.c b/src/cmd/8g/cgen.c
index 9c326e8ef1..036188fec4 100644
--- a/src/cmd/8g/cgen.c
+++ b/src/cmd/8g/cgen.c
@@ -78,6 +78,8 @@ cgen(Node *n, Node *res)
// structs etc get handled specially
if(isfat(n->type)) {
+ if(n->type->width < 0)
+ fatal("forgot to compute width for %T", n->type);
sgen(n, res, n->type->width);
return;
}
diff --git a/src/cmd/gc/dcl.c b/src/cmd/gc/dcl.c
index bf164b3f43..80cb74408a 100644
--- a/src/cmd/gc/dcl.c
+++ b/src/cmd/gc/dcl.c
@@ -684,6 +684,10 @@ ok:
pt->nod = n;
pt->sym = n->sym;
pt->sym->lastlineno = parserline();
+ pt->siggen = 0;
+ pt->printed = 0;
+ pt->deferwidth = 0;
+ pt->local = 0;
declare(n, PEXTERN);
checkwidth(pt);
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c
index ae556ae3fb..bee3c25b0d 100644
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -142,7 +142,9 @@ walkdeftype(Node *n)
}
// copy new type and clear fields
- // that don't come along
+ // that don't come along.
+ // anything zeroed here must be zeroed in
+ // typedcl2 too.
maplineno = n->type->maplineno;
embedlineno = n->type->embedlineno;
*n->type = *t;