https://gcc.gnu.org/g:201fd7899da99767f88fbd75d61b20fdc0cc190d
commit r16-1157-g201fd7899da99767f88fbd75d61b20fdc0cc190d Author: Ronan Desplanques <desplanq...@adacore.com> Date: Mon Jan 27 12:04:41 2025 +0100 ada: Fix crash on access to protected return 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. Diff: --- gcc/ada/exp_ch4.adb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 8c724844eb32..eb9fb6bba569 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -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;