https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120705
--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- Probably just: diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index cf2238e9ee1..651e55c5242 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -6902,7 +6902,9 @@ package body Exp_Ch3 is -- Processing for objects that require finalization actions - if Needs_Finalization (Ret_Typ) then + if Needs_Finalization (Ret_Typ) + and then not Has_Relaxed_Finalization (Ret_Typ) + then declare Decls : constant List_Id := New_List; Fin_Coll_Id : constant Entity_Id := diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 2a246adbb8a..b80dcd5baf2 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -9565,9 +9565,8 @@ package body Exp_Ch6 is -- such build-in-place functions, primitive or not. return not Restriction_Active (No_Finalization) - and then ((Needs_Finalization (Typ) - and then not Has_Relaxed_Finalization (Typ)) - or else Is_Tagged_Type (Typ)) + and then (Needs_Finalization (Typ) or else Is_Tagged_Type (Typ)) + and then not Has_Relaxed_Finalization (Typ) and then not Has_Foreign_Convention (Typ); end Needs_BIP_Collection;