diff mbox series

[Ada] Fix compiler crash on FOR iteration scheme over container

Message ID 20220513080736.GA2465495@adacore.com
State New
Headers show
Series [Ada] Fix compiler crash on FOR iteration scheme over container | expand

Commit Message

Pierre-Marie de Rodat May 13, 2022, 8:07 a.m. UTC
The front-end drops a freeze node on the floor because it puts the node
into the Condition_Actions of an N_Iteration_Scheme of a FOR loop.

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

gcc/ada/

	* exp_util.adb (Insert_Actions) <N_Iteration_Scheme>: Check that
	it is a WHILE iteration scheme before using Condition_Actions.
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
@@ -7545,7 +7545,7 @@  package body Exp_Util is
             when N_Elsif_Part
                | N_Iteration_Scheme
             =>
-               if N = Condition (P) then
+               if Present (Condition (P)) and then N = Condition (P) then
                   if Present (Condition_Actions (P)) then
                      Insert_List_After_And_Analyze
                        (Last (Condition_Actions (P)), Ins_Actions);