aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHristian Kirtchev <kirtchev@adacore.com>2019-07-05 07:03:00 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-05 07:03:00 +0000
commitbe0443c30242995d615345d546987dace6ca1b07 (patch)
treea83f130612558399f1b1db097cf147b002e12bb6
parentfe04f57a81366e5aaf0fec054d87919f6c243947 (diff)
downloadgcc-be0443c30242995d615345d546987dace6ca1b07.zip
gcc-be0443c30242995d615345d546987dace6ca1b07.tar.gz
gcc-be0443c30242995d615345d546987dace6ca1b07.tar.bz2
[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
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_res.adb16
2 files changed, 11 insertions, 12 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 65197d5..9658895 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+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>
* libgnarl/s-linux.ads, libgnarl/s-linux__alpha.ads,
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 8dc8eeb..b86e7cc 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;
--------------------------------