https://gcc.gnu.org/g:6a3abaf005f3d21eb261bd052d97dde2a87428e8
commit r16-2414-g6a3abaf005f3d21eb261bd052d97dde2a87428e8 Author: Eric Botcazou <ebotca...@adacore.com> Date: Tue Jul 8 21:40:44 2025 +0200 ada: Remove obsolete code from Safe_Unchecked_Type_Conversion That's a kludge added to work around the limitations of the stack checking mechanism used in the early days. gcc/ada/ChangeLog: * exp_util.ads (May_Generate_Large_Temp): Delete. * exp_util.adb (May_Generate_Large_Temp): Likewise. (Safe_Unchecked_Type_Conversion): Do not take stack checking into account to compute the result. Diff: --- gcc/ada/exp_util.adb | 35 ----------------------------------- gcc/ada/exp_util.ads | 10 ---------- 2 files changed, 45 deletions(-) diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index ac49c6b38267..769e0c01c243 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -11741,34 +11741,6 @@ package body Exp_Util is end if; end Matching_Standard_Type; - ----------------------------- - -- May_Generate_Large_Temp -- - ----------------------------- - - -- At the current time, the only types that we return False for (i.e. where - -- we decide we know they cannot generate large temps) are ones where we - -- know the size is 256 bits or less at compile time, and we are still not - -- doing a thorough job on arrays and records. - - function May_Generate_Large_Temp (Typ : Entity_Id) return Boolean is - begin - if not Size_Known_At_Compile_Time (Typ) then - return False; - end if; - - if Known_Esize (Typ) and then Esize (Typ) <= 256 then - return False; - end if; - - if Is_Array_Type (Typ) - and then Present (Packed_Array_Impl_Type (Typ)) - then - return May_Generate_Large_Temp (Packed_Array_Impl_Type (Typ)); - end if; - - return True; - end May_Generate_Large_Temp; - --------------------------------------- -- Move_To_Initialization_Statements -- --------------------------------------- @@ -13872,14 +13844,7 @@ package body Exp_Util is -- known size, but we can't consider them that way here, because we are -- talking about the actual size of the object. - -- We also make sure that in addition to the size being known, we do not - -- have a case which might generate an embarrassingly large temp in - -- stack checking mode. - elsif Size_Known_At_Compile_Time (Otyp) - and then - (not Stack_Checking_Enabled - or else not May_Generate_Large_Temp (Otyp)) and then not (Is_Record_Type (Otyp) and then not Is_Constrained (Otyp)) then return True; diff --git a/gcc/ada/exp_util.ads b/gcc/ada/exp_util.ads index b8b752523c3c..4226fcc93777 100644 --- a/gcc/ada/exp_util.ads +++ b/gcc/ada/exp_util.ads @@ -1064,16 +1064,6 @@ package Exp_Util is -- typically return Standard_Short_Integer. For fixed-point types, this -- will return integer types of the corresponding size. - function May_Generate_Large_Temp (Typ : Entity_Id) return Boolean; - -- Determines if the given type, Typ, may require a large temporary of the - -- kind that causes back-end trouble if stack checking is enabled. The - -- result is True only the size of the type is known at compile time and - -- large, where large is defined heuristically by the body of this routine. - -- The purpose of this routine is to help avoid generating troublesome - -- temporaries that interfere with stack checking mechanism. Note that the - -- caller has to check whether stack checking is actually enabled in order - -- to guide the expansion (typically of a function call). - procedure Move_To_Initialization_Statements (Decl, Stop : Node_Id); -- Decl is an N_Object_Declaration node and Stop is a node past Decl in -- the same list. Move all the nodes on the list between Decl and Stop