Commit be0443c3 by Hristian Kirtchev Committed by Pierre-Marie de Rodat

[Ada] Failure to detect trivial infinite recursion

This patch includes delay statements in the set of control flow
statements since their expressions may have side effects, which in turn
may affect an infinite recursion.

2019-07-05  Hristian Kirtchev  <kirtchev@adacore.com>

gcc/ada/

	* sem_res.adb (Is_Control_Flow_Statement): Delay statements
	contain an expression, which in turn may have side effects and
	affect the infinite recursion. As a result, delay statements
	should not be treated specially.

From-SVN: r273118
parent fe04f57a
2019-07-05 Hristian Kirtchev <kirtchev@adacore.com>
* sem_res.adb (Is_Control_Flow_Statement): Delay statements
contain an expression, which in turn may have side effects and
affect the infinite recursion. As a result, delay statements
should not be treated specially.
2019-07-05 Arnaud Charlet <charlet@adacore.com> 2019-07-05 Arnaud Charlet <charlet@adacore.com>
* libgnarl/s-linux.ads, libgnarl/s-linux__alpha.ads, * libgnarl/s-linux.ads, libgnarl/s-linux__alpha.ads,
......
...@@ -816,19 +816,11 @@ package body Sem_Res is ...@@ -816,19 +816,11 @@ package body Sem_Res is
function Is_Control_Flow_Statement (N : Node_Id) return Boolean is function Is_Control_Flow_Statement (N : Node_Id) return Boolean is
begin begin
-- Delay statements do not affect the control flow because they -- It is assumed that all statements may affect the control flow in
-- simply postpone the execution of all subsequent statements. -- some way. A raise statement may be expanded into a non-statement
-- node.
if Nkind (N) in N_Delay_Statement then return Is_Statement (N) or else Is_Raise_Statement (N);
return False;
-- Otherwise it is assumed that all other statements may affect the
-- control flow in some way. A raise statement may be expanded into
-- a non-statement node.
else
return Is_Statement (N) or else Is_Raise_Statement (N);
end if;
end Is_Control_Flow_Statement; end Is_Control_Flow_Statement;
-------------------------------- --------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment