https://gcc.gnu.org/g:5582d982396a372e583077ff6716fb40896614da
commit r17-939-g5582d982396a372e583077ff6716fb40896614da Author: Viljar Indus <[email protected]> Date: Tue Mar 17 09:40:27 2026 +0200 ada: Unset Comes_From_Source in inlined static functions Unset Comes_From_Source in the inlined expression in order to avoid spurious resolution errors. gcc/ada/ChangeLog: * inline.adb (Adjust_Node): Renamed from Adjust_Sloc and additionally unset Comes_From_Source. Diff: --- gcc/ada/inline.adb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 7d7eff6c91b1..93ec997ce333 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -4721,9 +4721,10 @@ package body Inline is Expr_Copy : constant Node_Id := New_Copy_Tree (Func_Expr); S_Adjustment : Sloc_Adjustment; - function Adjust_Sloc (Nod : Node_Id) return Traverse_Result; - -- Update the child node with the instantiation adjustment - -- information for error messages. + function Adjust_Node (Nod : Node_Id) return Traverse_Result; + -- Update the child node with the instantiation adjustment information + -- for error messages and mark the node as not coming from source to + -- avoid spurious resolution errors in inlined code. function Replace_Formal (N : Node_Id) return Traverse_Result; -- Replace each occurrence of a formal with the @@ -4731,16 +4732,17 @@ package body Inline is -- by Establish_Actual_Mapping_For_Inlined_Call. ----------------- - -- Adjust_Sloc -- + -- Adjust_Node -- ----------------- - function Adjust_Sloc (Nod : Node_Id) return Traverse_Result is + function Adjust_Node (Nod : Node_Id) return Traverse_Result is begin Adjust_Instantiation_Sloc (Nod, S_Adjustment); + Set_Comes_From_Source (Nod, False); return OK; - end Adjust_Sloc; + end Adjust_Node; - procedure Adjust_Slocs is new Traverse_Proc (Adjust_Sloc); + procedure Adjust_Nodes is new Traverse_Proc (Adjust_Node); -------------------- -- Replace_Formal -- @@ -4807,7 +4809,7 @@ package body Inline is Replace_Formals (Expr_Copy); - Adjust_Slocs (Expr_Copy); + Adjust_Nodes (Expr_Copy); -- Apply a qualified expression with the function's result subtype, -- to ensure that we check the expression against any constraint
