diff mbox series

[Ada] Crash on a nested aggregate containing controlled objects

Message ID 20210617143311.GA10343@adacore.com
State New
Headers show
Series [Ada] Crash on a nested aggregate containing controlled objects | expand

Commit Message

Pierre-Marie de Rodat June 17, 2021, 2:33 p.m. UTC
Exp_Util.Find_Hook_Context wasn't prepared to handle this case properly
and we ended up inserting a statement in the middle of an aggregate,
causing chaos.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* exp_util.adb (Find_Hook_Context): Do not stop on an aggregate
	node.
diff mbox series

Patch

diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb
--- a/gcc/ada/exp_util.adb
+++ b/gcc/ada/exp_util.adb
@@ -6220,6 +6220,9 @@  package body Exp_Util is
                                         | N_Discriminant_Association
                                         | N_Parameter_Association
                                         | N_Pragma_Argument_Association
+                                        | N_Aggregate
+                                        | N_Delta_Aggregate
+                                        | N_Extension_Aggregate
               and then Nkind (Parent (Par)) not in N_Function_Call
                                                  | N_Procedure_Call_Statement
                                                  | N_Entry_Call_Statement