Message ID | 2521834.XAFRqVoOGU@fomalhaut |
---|---|
State | New |
Headers | show |
Series | [Ada] Fix PR ada/116430 | expand |
diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index e594a534244..123abb63289 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -2051,6 +2051,12 @@ package body Exp_Ch7 is and then List_Containing (Finalizer_Insert_Nod) = Stmts) then Finalizer_Insert_Nod := Last_Top_Level_Ctrl_Construct; + if Nkind (Finalizer_Insert_Nod) = N_Package_Body + and then Nkind (Parent (Finalizer_Insert_Nod)) = N_Subunit + then + Finalizer_Insert_Nod := + Corresponding_Stub (Parent (Finalizer_Insert_Nod)); + end if; end if; Insert_After (Finalizer_Insert_Nod, Fin_Body);