]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix oversight in previous change
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 14 Dec 2023 12:05:52 +0000 (13:05 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Tue, 21 May 2024 07:26:49 +0000 (09:26 +0200)
In rare cases, types using structural equality may reach relate_alias_sets.

gcc/ada/

* gcc-interface/utils.cc (relate_alias_sets): Restore previous code
when the type uses structural equality.

gcc/ada/gcc-interface/utils.cc

index b628481335d25e3e904044e0868103d7dfbd36c9..ae520542ace669ac0082db510b942f2d67ad2d5a 100644 (file)
@@ -1867,8 +1867,11 @@ relate_alias_sets (tree new_type, tree old_type, enum alias_set_op op)
                      && TYPE_NONALIASED_COMPONENT (new_type)
                         != TYPE_NONALIASED_COMPONENT (old_type)));
 
-      /* The alias set always lives on the TYPE_CANONICAL.  */
-      TYPE_ALIAS_SET (TYPE_CANONICAL (new_type)) = get_alias_set (old_type);
+      /* The alias set is a property of the TYPE_CANONICAL if it exists.  */
+      if (TYPE_STRUCTURAL_EQUALITY_P (new_type))
+       TYPE_ALIAS_SET (new_type) = get_alias_set (old_type);
+      else
+       TYPE_ALIAS_SET (TYPE_CANONICAL (new_type)) = get_alias_set (old_type);
       break;
 
     case ALIAS_SET_SUBSET: