Which types are getting through to reflect without valid widths? I think this is
a bug elsewhere in gc and this is just a bandaid.
GC type gen is after function compilation, so any type without a valid width
will have been miscompiled anyway.
On 2013/04/24 11:09:28, DMorsing wrote:
> Which types are getting through to reflect without valid widths? I think this
is
> a bug elsewhere in gc and this is just a bandaid.
>
> GC type gen is after function compilation, so any type without a valid width
> will have been miscompiled anyway.
Calls to dowidth(Type*) are distributed over multiple places in src/cmd/gc/*.c
and the rule seems to be that it is called to initialize struct Type before
accessing certain fields of the struct.
It would be clearer to compute all widths in one pass and one place, but this
doesn't seem to be the case in the current implementation.
Alternatively, one could introduce an accessor function such as getwidth(Type*
t). This would be safer to use that accessing t->width directly.
On 2013/04/24 11:47:53, atom wrote:
> On 2013/04/24 11:09:28, DMorsing wrote:
> > Which types are getting through to reflect without valid widths? I think
this
> is
> > a bug elsewhere in gc and this is just a bandaid.
> >
> > GC type gen is after function compilation, so any type without a valid width
> > will have been miscompiled anyway.
>
> Calls to dowidth(Type*) are distributed over multiple places in src/cmd/gc/*.c
> and the rule seems to be that it is called to initialize struct Type before
> accessing certain fields of the struct.
>
That is correct, but all those calls happen before or during codegen. If the
width of a type isn't set after codegen, there's a good chance we're
miscompiling code using that type.
On 2013/04/24 11:09:28, DMorsing wrote:
> Which types are getting through to reflect without valid widths? I think this
is
> a bug elsewhere in gc and this is just a bandaid.
>
> GC type gen is after function compilation, so any type without a valid width
> will have been miscompiled anyway.
You can clpatch 8607045 to get a test case that shows the problem.
On 2013/04/24 13:45:19, iant wrote:
> On 2013/04/24 11:09:28, DMorsing wrote:
> > Which types are getting through to reflect without valid widths? I think
this
> is
> > a bug elsewhere in gc and this is just a bandaid.
> >
> > GC type gen is after function compilation, so any type without a valid width
> > will have been miscompiled anyway.
>
> You can clpatch 8607045 to get a test case that shows the problem.
In fact, that test case ought to be part of this CL.
On 2013/04/24 13:45:43, iant wrote:
> On 2013/04/24 13:45:19, iant wrote:
> > On 2013/04/24 11:09:28, DMorsing wrote:
> > > Which types are getting through to reflect without valid widths? I think
> this
> > is
> > > a bug elsewhere in gc and this is just a bandaid.
> > >
> > > GC type gen is after function compilation, so any type without a valid
width
> > > will have been miscompiled anyway.
> >
> > You can clpatch 8607045 to get a test case that shows the problem.
>
> In fact, that test case ought to be part of this CL.
Done.
Patch looks good, test case needs a bit of cleanup. Thanks. https://codereview.appspot.com/8663052/diff/15001/test/fixedbugs/issue5291.dir/pkg1.go File test/fixedbugs/issue5291.dir/pkg1.go (right): ...
Issue 8663052: code review 8663052: cmd/gc: initialize t->width in dgcsym() if required
(Closed)
Created 12 years ago by atom
Modified 12 years ago
Reviewers:
Base URL:
Comments: 12