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

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Some comments:
+  else
+    {
+       TYPE_CANONICAL (t) = t;
+    }
The formatting here is wrong, TYPE_CANONICAL is indented too much, but we also
don't put a single statement between {}s, so just
  else
    TYPE_CANONICAL (t) = t;

NULL_TREE == TYPE_CANONICAL
!TYPE_CANONICAL

We don't use constant == non-constant style, but non-constant == constant, but
here
both of the above should just be
TYPE_STRUCTURAL_EQUALITY_P

+         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.

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.

Reply via email to