https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89692

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #10)
> (In reply to Jakub Jelinek from comment #8)
> > Can't we change that way e.g. TYPE_CANONICAL of some type?
> 
> The types are unused, otherwise they'd be visited by fld.

useless_type_conversion_p still do use TYPE_CANONICAL etc., but fld doesn't
walk it (unless TYPE_CANONICAL is equal to a type that has been walked (guess
the usual case):

      /* Do not walk TYPE_CANONICAL.  We do not stream it and thus do not
         and want not to reach unused types this way.  */

> > I would feel much safer if we do this TYPE_NEXT_VARIANT adjustment with 
> > turning > those types left out into distinct type if we'd fld_worklist_push
> > (TYPE_CANONICAL (type), fld); and so there would be at least sanity in what 
> > say > later build_qualified_type creates etc.
> 
> not sure what you are refering to.  All type-reuse keys on TYPE_MAIN_VARIANT
> in the end and iff a such freed type is picked up later then FLD misses
> some important use chain.  The only one that might still come along the
> type is the garbage collector and I was worried it might go off into
> cycles if we leave TYPE_NEXT/MAIN_VARIANT unchanged but change the
> TYPE_MAIN_VARIANT varaint chain.

I was worried that we visit some type that has TYPE_CANONICAL we don't visit,
so it is removed from the TYPE_NEXT_VARIANT chain, and if that happens e.g. for
two variants of the same type, if they have different TYPE_CANONICAL (e.g.
because of different qualifications), it might cause trouble if those
TYPE_CANONICALs no longer have the same TYPE_MAIN_VARIANT.

Reply via email to