Commit ed39c764 authored by Russ Cox's avatar Russ Cox

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

Fixes #879.

R=ken2
CC=golang-dev
https://golang.org/cl/1678048
parent 040f0818
...@@ -225,6 +225,8 @@ dowidth(Type *t) ...@@ -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) ...@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment