diff options
Diffstat (limited to 'gcc/ada/exp_util.adb')
-rw-r--r-- | gcc/ada/exp_util.adb | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 9077891..2172ce7 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -6190,11 +6190,17 @@ package body Exp_Util is Utyp := Corresponding_Record_Type (Root_Type (Btyp)); else - Utyp := Underlying_Type (Root_Type (Btyp)); - - if Is_Protected_Type (Utyp) then - Utyp := Corresponding_Record_Type (Utyp); - end if; + declare + Root : constant Entity_Id := Underlying_Type (Root_Type (Btyp)); + begin + if Is_Protected_Type (Root) then + Utyp := Corresponding_Record_Type (Root); + else + while No (TSS (Utyp, TSS_Finalize_Address)) loop + Utyp := Underlying_Type (Base_Type (Etype (Utyp))); + end loop; + end if; + end; end if; end if; @@ -8167,21 +8173,21 @@ package body Exp_Util is -- never climb up as far as the N_Expression_With_Actions itself. when N_Expression_With_Actions => - if N = Expression (P) then - if Is_Empty_List (Actions (P)) then - Append_List_To (Actions (P), Ins_Actions); - Analyze_List (Actions (P)); - else - Insert_List_After_And_Analyze - (Last (Actions (P)), Ins_Actions); - end if; - - return; + if Is_List_Member (N) and then List_Containing (N) = Actions (P) + then + raise Program_Error; + end if; + if Is_Empty_List (Actions (P)) then + Append_List_To (Actions (P), Ins_Actions); + Analyze_List (Actions (P)); else - raise Program_Error; + Insert_List_After_And_Analyze + (Last (Actions (P)), Ins_Actions); end if; + return; + -- Case of appearing in the condition of a while expression or -- elsif. We insert the actions into the Condition_Actions field. -- They will be moved further out when the while loop or elsif |