[Ada] Hang on conditional expression as actual

gcc/ada/

	* exp_ch6.adb (Expand_Branch): Verify the original node is a
	conditional expression before recursing further.
	(Insert_Level_Assign): Transform assertion into an explicit
	raise.
This commit is contained in:
Justin Squirek 2020-05-13 18:59:29 -04:00 committed by Pierre-Marie de Rodat
parent 1c4b5a795a
commit 7bf53b1a61

View File

@ -3947,6 +3947,11 @@ package body Exp_Ch6 is
if Nkind (Expression (Assn)) = if Nkind (Expression (Assn)) =
N_Expression_With_Actions N_Expression_With_Actions
and then
Nkind_In
(Original_Node (Expression (Assn)),
N_Case_Expression,
N_If_Expression)
then then
Insert_Level_Assign (Expression (Assn)); Insert_Level_Assign (Expression (Assn));
@ -3983,7 +3988,10 @@ package body Exp_Ch6 is
N_If_Statement); N_If_Statement);
Next (Cond); Next (Cond);
pragma Assert (Present (Cond));
if No (Cond) then
raise Program_Error;
end if;
end loop; end loop;
-- Iterate through if expression branches -- Iterate through if expression branches