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

--- Comment #18 from Martin Uecker <muecker at gwdg dot de> ---

> 
> +       TYPE_CANONICAL (x) = TYPE_CANONICAL (t);
> As has been discussed, this is wrong, it should have been
> TYPE_CANONICAL (x) = build_qualified_type (TYPE_CANONICAL (t), TYPE_QUALS
> (x));
> or so.

Thanks

> 
> The build_pointer_type change looks really weird.
> I'd say if you want to be prepared for to_type formerly
> TYPE_STRUCTURAL_EQUALITY_P types and now no longer so, we should just change
>   for (t = TYPE_POINTER_TO (to_type); t; t = TYPE_NEXT_PTR_TO (t))
>     if (TYPE_MODE (t) == mode && TYPE_REF_CAN_ALIAS_ALL (t) == can_alias_all)
>       return t;
> loop to check for this case before return t; (i.e. { if
> (!TYPE_STRUCTURAL_EQUALITY_P (to_type) && !in_lto_p &&
> TYPE_STRUCTURAL_EQUALITY_P (t)) TYPE_CANONICAL (t) =
> build_pointer_type_for_mode (TYPE_CANONICAL (to_type), mode, false); return
> t; }
> or so, and do something similar also for array types and the like.
> And maybe instead of tweaking asserts in ipa-free-lang-data also update
> TYPE_CANONICAL on the derived types if the base type doesn't have
> TYPE_STRUCTURAL_EQUALITY_P.

I am just looking at a version that would have changed the condition to:

  if (TYPE_MODE (t) == mode && TYPE_REF_CAN_ALIAS_ALL (t) == can_alias_all
     && TYPE_STRUCTURAL_EQUALITY_P (t) == TYPE_STRUCTURAL_EQUALITY_P (to_type))

Martin

Reply via email to