]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix restoration of parent link
authorMarc Poulhiès <poulhies@adacore.com>
Wed, 22 Mar 2023 09:43:07 +0000 (10:43 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:18 +0000 (10:23 +0200)
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.

gcc/ada/contracts.adb

index 012ea33cf896478f1fa32a1e23b4a20a72f3eb0b..9d02887cfa12c146b11a01b71a9113fc1cbd3110 100644 (file)
@@ -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;