This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.

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

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.
--- gcc/ada/sem_res.adb
+++ gcc/ada/sem_res.adb
@@ -816,19 +816,11 @@ package body Sem_Res is
 
       function Is_Control_Flow_Statement (N : Node_Id) return Boolean is
       begin
-         --  Delay statements do not affect the control flow because they
-         --  simply postpone the execution of all subsequent statements.
+         --  It is assumed that all statements may affect the control flow in
+         --  some way. A raise statement may be expanded into a non-statement
+         --  node.
 
-         if Nkind (N) in N_Delay_Statement then
-            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;
+         return Is_Statement (N) or else Is_Raise_Statement (N);
       end Is_Control_Flow_Statement;
 
       --------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]