From: Denis Mazzucato <mazzuc...@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 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 ce5b800e48c..709f6254b5e 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));
-- 
2.43.0

Reply via email to