]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Ada: Fix ICE in fld_incomplete_type_of when building GtkAda with LTO (3)
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 22 Dec 2025 22:46:53 +0000 (23:46 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Mon, 22 Dec 2025 22:49:13 +0000 (23:49 +0100)
This streamlines the code by using a ternary expression.

gcc/ada/
PR ada/123060
* gcc-interface/utils.cc (update_pointer_to): Streamline.

gcc/ada/gcc-interface/utils.cc

index 9176ec29d566e160aa50f9816fe025398130469f..4f0bdec022eebc00c6d1134b3a22c4aa56ddca37 100644 (file)
@@ -4689,11 +4689,10 @@ update_pointer_to (tree old_type, tree new_type)
                       && !lookup_attribute ("may_alias",
                                             TYPE_ATTRIBUTES (new_type))))
            {
-             alias_set_type set;
-             if (TYPE_STRUCTURAL_EQUALITY_P (old_ptr))
-               set = TYPE_ALIAS_SET (old_ptr);
-             else
-               set = TYPE_ALIAS_SET (TYPE_CANONICAL (old_ptr));
+             const alias_set_type set
+               = TYPE_STRUCTURAL_EQUALITY_P (old_ptr)
+                 ? TYPE_ALIAS_SET (old_ptr)
+                 : TYPE_ALIAS_SET (TYPE_CANONICAL (old_ptr));
              TYPE_CANONICAL (old_ptr)
                = build_pointer_type (TYPE_CANONICAL (new_type));
              TYPE_ALIAS_SET (TYPE_CANONICAL (old_ptr)) = set;
@@ -4734,11 +4733,10 @@ update_pointer_to (tree old_type, tree new_type)
                       && !lookup_attribute ("may_alias",
                                             TYPE_ATTRIBUTES (new_type))))
            {
-             alias_set_type set;
-             if (TYPE_STRUCTURAL_EQUALITY_P (old_ref))
-               set = TYPE_ALIAS_SET (old_ref);
-             else
-               set = TYPE_ALIAS_SET (TYPE_CANONICAL (old_ref));
+             const alias_set_type set
+               = TYPE_STRUCTURAL_EQUALITY_P (old_ref)
+                 ? TYPE_ALIAS_SET (old_ref)
+                 : TYPE_ALIAS_SET (TYPE_CANONICAL (old_ref));
              TYPE_CANONICAL (old_ref)
                = build_reference_type (TYPE_CANONICAL (new_type));
              TYPE_ALIAS_SET (TYPE_CANONICAL (old_ref)) = set;