mirror of
https://github.com/golang/go
synced 2024-11-22 04:24:39 -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;
|
uint64 cap;
|
||||||
|
|
||||||
dowidth(t->type);
|
dowidth(t->type);
|
||||||
|
if(t->type->width == 0)
|
||||||
|
fatal("no width for type %T", t->type);
|
||||||
if(tptr == TPTR32)
|
if(tptr == TPTR32)
|
||||||
cap = ((uint32)-1) / t->type->width;
|
cap = ((uint32)-1) / t->type->width;
|
||||||
else
|
else
|
||||||
@ -275,6 +277,9 @@ dowidth(Type *t)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// catch all for error cases; avoid divide by zero later
|
||||||
|
if(w == 0)
|
||||||
|
w = maxround;
|
||||||
t->width = w;
|
t->width = w;
|
||||||
lineno = lno;
|
lineno = lno;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user