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:
parent
040f081842
commit
ed39c764b8
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user