[COMMITTED] ada: Fix restoration of parent link

Message ID 20230529082851.2409033-1-poulhies@adacore.com
State Committed
Commit 4c33d93bfe8582375d4e56faebb911854517a9f3
Headers
Series [COMMITTED] ada: Fix restoration of parent link |

Commit Message

Marc Poulhiès May 29, 2023, 8:28 a.m. UTC
  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(-)
  

Patch

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;