Commit caff4398 authored by Rémy Oudompheng's avatar Rémy Oudompheng

cmd/gc: more graceful handling of invalid fields in widstruct.

The protection against segfaults does not completely solve
crashes and breaks test/fixedbugs/bug365.go

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6615058
parent 54191126
......@@ -54,8 +54,11 @@ widstruct(Type *errtype, Type *t, vlong o, int flag)
for(f=t->type; f!=T; f=f->down) {
if(f->etype != TFIELD)
fatal("widstruct: not TFIELD: %lT", f);
if(f->type == T)
break;
if(f->type == T) {
// broken field, just skip it so that other valid fields
// get a width.
continue;
}
dowidth(f->type);
if(f->type->align > maxalign)
maxalign = f->type->align;
......
......@@ -146,7 +146,7 @@ struct Type
uchar copyany;
uchar local; // created in this file
uchar deferwidth;
uchar broke;
uchar broke; // broken type definition.
uchar isddd; // TFIELD is ... argument
uchar align;
......
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