> > + gcc_assert (TYPE_CANONICAL (t2) != t2
> > + && TYPE_CANONICAL (t2) == TYPE_CANONICAL (TREE_TYPE (t)));
> > + TYPE_CANONICAL (first) = TYPE_CANONICAL (TYPE_MAIN_VARIANT (t));
>
> as said the TYPE_CANONICAL assign should be already done exactly this
> way in build_{poitner,reference}_for_mode. So you should be able to
> drop this from the patch.
OK, I have turned this into a sanity check and re-testing.
>
> > add_tree_to_fld_list (first, fld);
> > return fld_type_variant (first, t, fld);
> > }
> > @@ -5169,6 +5172,7 @@ fld_incomplete_type_of (tree t, struct f
> > SET_TYPE_MODE (copy, VOIDmode);
> > SET_TYPE_ALIGN (copy, BITS_PER_UNIT);
> > TYPE_SIZE_UNIT (copy) = NULL;
> > + TYPE_CANONICAL (copy) = t;
>
> Or use build_variant_type_copy in the first place? But you do not
> seme to queue the new types in the variant list?
build_variant_type_copy would set TYPE_MAIN_VARAINT (copy) to be T.
I do not want this to happen since streaming would then pick complete
type as well.
Honza