]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix crash when creating extra formals for aliased types
authorDenis Mazzucato <mazzucato@adacore.com>
Wed, 9 Jul 2025 10:03:53 +0000 (12:03 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 22 Jul 2025 08:35:16 +0000 (10:35 +0200)
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.

gcc/ada/sem_ch6.adb

index ce5b800e48c955b7b9546052f27fe3ca800082bd..709f6254b5ec3771326f34e325702859e7d8d650 100644 (file)
@@ -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));