From: Hristian Kirtchev Date: Fri, 5 Jul 2019 07:03:00 +0000 (+0000) Subject: [Ada] Failure to detect trivial infinite recursion X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=be0443c30242995d615345d546987dace6ca1b07;p=gcc.git [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 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 65197d54c52..9658895ee27 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2019-07-05 Hristian Kirtchev + + * 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 * libgnarl/s-linux.ads, libgnarl/s-linux__alpha.ads, diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 8dc8eebcaf2..b86e7cce4b6 100644 --- a/gcc/ada/sem_res.adb +++ b/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; --------------------------------