https://gcc.gnu.org/g:3289f1a374481d85c01f2db30201ea815624e612

commit r16-2416-g3289f1a374481d85c01f2db30201ea815624e612
Author: Denis Mazzucato <mazzuc...@adacore.com>
Date:   Wed Jul 9 12:03:53 2025 +0200

    ada: Fix crash when creating extra formals for aliased types
    
    This patch makes sure that we return the same decision for all aliased
    types when checking if the BIP task extra actuals are needed.
    
    gcc/ada/ChangeLog:
    
            * sem_ch6.adb (Might_Need_BIP_Task_Actuals): Before retrieving the 
original corresponding
            operation we retrieve first the root of the aliased chain.

Diff:
---
 gcc/ada/sem_ch6.adb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index ce5b800e48c9..709f6254b5ec 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -8684,17 +8684,18 @@ package body Sem_Ch6 is
          then
             Subp_Id := Protected_Body_Subprogram (E);
 
-         --  For access to subprogram types we look at the return type of the
+         --  For access-to-subprogram types we look at the return type of the
          --  subprogram type itself, as it cannot be overridden or inherited.
 
          elsif Ekind (E) = E_Subprogram_Type then
             Subp_Id := E;
 
          --  Otherwise, we need to return the same value we would return for
-         --  the original corresponding operation.
+         --  the original corresponding operation of the root of the aliased
+         --  chain.
 
          else
-            Subp_Id := Original_Corresponding_Operation (E);
+            Subp_Id := Original_Corresponding_Operation (Ultimate_Alias (E));
          end if;
 
          Original := Underlying_Type (Etype (Subp_Id));

Reply via email to