On Thu, Jan 24, 2019 at 3:59 PM Nikhil Benesch <nikhil.bene...@gmail.com> wrote: > > On Thu, Jan 24, 2019 at 6:01 AM Richard Biener > <richard.guent...@gmail.com> wrote: > > > > On Thu, Jan 24, 2019 at 2:18 AM Nikhil Benesch <nikhil.bene...@gmail.com> > > wrote: > > > > > > diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc > > > index 7fbdd074119..4e9e0e3026a 100644 > > > --- a/gcc/go/go-gcc.cc > > > +++ b/gcc/go/go-gcc.cc > > > @@ -1049,6 +1049,7 @@ Gcc_backend::set_placeholder_pointer_type(Btype* > > > placeholder, > > > } > > > gcc_assert(TREE_CODE(tt) == POINTER_TYPE); > > > TREE_TYPE(pt) = TREE_TYPE(tt); > > > + TYPE_CANONICAL(pt) = TYPE_CANONICAL(tt); > > > > This doesn't make sense - it says to the middle-end that > > T* is equal to T? > > Not quite. When this function is called, pt is a placeholder of type U*, > where U is some unknown type, and tt has type T*, where T is a complete > type. The goal is to make pt look exactly like tt, i.e., fill in the > placeholder.
Ah, I missed that pt is probably a pointer type as well, then the code simply aligns the pointed-to type (note dependent on how pt was built this seems prone to wreck the TYPE_POINTER_TO/TYPE_NEXT_PTR_TO chains which link pointer types to a type. > I realize now that my changelog entry isn't quite precise about this. > Perhaps the second entry should instead read "Propagate the canonical > type from the desired pointer type to the placeholder pointer type".