https://gcc.gnu.org/g:547da3126842551445e653dfd9310953defc3c2b

commit r14-12214-g547da3126842551445e653dfd9310953defc3c2b
Author: Eric Botcazou <[email protected]>
Date:   Mon Dec 22 23:46:53 2025 +0100

    Ada: Fix ICE in fld_incomplete_type_of when building GtkAda with LTO (3)
    
    This streamlines the code by using a ternary expression.
    
    gcc/ada/
            PR ada/123060
            * gcc-interface/utils.cc (update_pointer_to): Streamline.

Diff:
---
 gcc/ada/gcc-interface/utils.cc | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index e29eaa0d3ad5..031c8e3c70a3 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -4469,11 +4469,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 (ptr))
-               set = TYPE_ALIAS_SET (ptr);
-             else
-               set = TYPE_ALIAS_SET (TYPE_CANONICAL (ptr));
+             const alias_set_type set
+               = TYPE_STRUCTURAL_EQUALITY_P (ptr)
+                 ? TYPE_ALIAS_SET (ptr)
+                 : TYPE_ALIAS_SET (TYPE_CANONICAL (ptr));
              TYPE_CANONICAL (ptr)
                = build_pointer_type (TYPE_CANONICAL (new_type));
              TYPE_ALIAS_SET (TYPE_CANONICAL (ptr)) = set;
@@ -4514,11 +4513,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 (ref))
-               set = TYPE_ALIAS_SET (ref);
-             else
-               set = TYPE_ALIAS_SET (TYPE_CANONICAL (ref));
+             const alias_set_type set
+               = TYPE_STRUCTURAL_EQUALITY_P (ref)
+                 ? TYPE_ALIAS_SET (ref)
+                 : TYPE_ALIAS_SET (TYPE_CANONICAL (ref));
              TYPE_CANONICAL (ref)
                = build_reference_type (TYPE_CANONICAL (new_type));
              TYPE_ALIAS_SET (TYPE_CANONICAL (ref)) = set;

Reply via email to