https://gcc.gnu.org/g:a37bb38838172db59abe4dc48eb2a120d9c295e5

commit r16-6344-ga37bb38838172db59abe4dc48eb2a120d9c295e5
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 9176ec29d566..4f0bdec022ee 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -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;

Reply via email to