]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix crash on access to protected return
authorRonan Desplanques <desplanques@adacore.com>
Mon, 27 Jan 2025 11:04:41 +0000 (12:04 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Thu, 5 Jun 2025 13:39:41 +0000 (15:39 +0200)
The generation of the check mandated by Ada issue AI05-0073 was not done
handled properly for protected types when used through subtypes. This
patch fixes the issue.

gcc/ada/ChangeLog:

* exp_ch4.adb (Tagged_Membership): Fix for protected types.

gcc/ada/exp_ch4.adb

index 8c724844eb32059c1019d7f182be05eb8f3e85df..eb9fb6bba5696c318619bd824fbca3034837c1a1 100644 (file)
@@ -15036,10 +15036,11 @@ package body Exp_Ch4 is
 
       --  Handle entities from the limited view
 
-      Orig_Right_Type : constant Entity_Id := Available_View (Etype (Right));
+      Orig_Right_Type : constant Entity_Id :=
+        Base_Type (Available_View (Etype (Right)));
 
       Full_R_Typ   : Entity_Id;
-      Left_Type    : Entity_Id := Available_View (Etype (Left));
+      Left_Type    : Entity_Id := Base_Type (Available_View (Etype (Left)));
       Right_Type   : Entity_Id := Orig_Right_Type;
       Obj_Tag      : Node_Id;