1
0
mirror of https://github.com/golang/go synced 2024-11-24 22:57:57 -07:00

gc: do not crash on bad [...]T

Fixes #879.

R=ken2
CC=golang-dev
https://golang.org/cl/1678048
This commit is contained in:
Russ Cox 2010-06-30 20:34:31 -07:00
parent 040f081842
commit ed39c764b8

View File

@ -225,6 +225,8 @@ dowidth(Type *t)
uint64 cap;
dowidth(t->type);
if(t->type->width == 0)
fatal("no width for type %T", t->type);
if(tptr == TPTR32)
cap = ((uint32)-1) / t->type->width;
else
@ -275,6 +277,9 @@ dowidth(Type *t)
break;
}
// catch all for error cases; avoid divide by zero later
if(w == 0)
w = maxround;
t->width = w;
lineno = lno;