When resetting the parent link after having restored the selected
component node, the assertion used was incorrectly triggered when the
traversal hits the members of the parameters association list, as in:

   This.Some_Func (Param1, Param2).Dispatching_Call

When restoring the selected component for Dispatching_Call, the
assertion was wrongly triggered when passed Param1 and Param2.

gcc/ada/

        * contracts.adb (Restore_Original_Selected_Component): Adjust assertion.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/contracts.adb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb
index 012ea33cf89..9d02887cfa1 100644
--- a/gcc/ada/contracts.adb
+++ b/gcc/ada/contracts.adb
@@ -4954,7 +4954,8 @@ package body Contracts is
 
             begin
                if Par /= Parent_Node then
-                  pragma Assert (not Is_List_Member (Node));
+                  pragma Assert (not Is_List_Member (Node)
+                                   or else Nkind (Par) = N_Function_Call);
                   Set_Parent (Node, Parent_Node);
                end if;
 
-- 
2.40.0

Reply via email to