aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2019-07-05 07:03:54 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-07-05 07:03:54 +0000
commit76e716d76171e50353e7eb80632ea75165eabdc0 (patch)
tree251a07dbc848e282ba8c7305e01dde1da72033a5 /gcc
parent3eb5e54a4a50f3e7c39a1f5435f9d4eedb26bb37 (diff)
downloadgcc-76e716d76171e50353e7eb80632ea75165eabdc0.zip
gcc-76e716d76171e50353e7eb80632ea75165eabdc0.tar.gz
gcc-76e716d76171e50353e7eb80632ea75165eabdc0.tar.bz2
[Ada] Compiler loop on illegal nested accept statement
This patch fixes a "Compilation abandoned" message in a compiler built with assertions, or a compiler loop otherwise, when an accept statement contains an illegal accept statement for the same entry. Compiling accept_in_accept.adb must yield: accept_in_accept.adb:12:13: duplicate accept statement for same entry (RM 9.5.2 (15)) ---- procedure accept_in_accept is task a_in_a is entry a (i : Integer); end a_in_a; task body a_in_a is begin select accept a (i : Integer) do null; accept a (i : integer) do null; end a; end a; or terminate; end select; end a_in_a; begin a_in_a.a (1); end accept_in_accept; 2019-07-05 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch9.adb (Analyze_Accept_Statement): If this is an illegal accept statement for an enclosing entry abandon analysis to prevent scope mismatches and potential infinite loops in compiler. From-SVN: r273129
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog7
-rw-r--r--gcc/ada/sem_ch9.adb8
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 6f04f77..c875ac3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,10 @@
+2019-07-05 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch9.adb (Analyze_Accept_Statement): If this is an illegal
+ accept statement for an enclosing entry abandon analysis to
+ prevent scope mismatches and potential infinite loops in
+ compiler.
+
2019-07-05 Hristian Kirtchev <kirtchev@adacore.com>
* ali.adb (For_Each_Invocation_Construct,
diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb
index a71c35c..19fff57 100644
--- a/gcc/ada/sem_ch9.adb
+++ b/gcc/ada/sem_ch9.adb
@@ -883,7 +883,13 @@ package body Sem_Ch9 is
exit when Task_Nam = Scope_Stack.Table (J).Entity;
if Entry_Nam = Scope_Stack.Table (J).Entity then
- Error_Msg_N ("duplicate accept statement for same entry", N);
+ Error_Msg_N
+ ("duplicate accept statement for same entry (RM 9.5.2 (15))", N);
+
+ -- Do not continue analysis of accept statement, to prevent
+ -- cascaded errors.
+
+ return;
end if;
end loop;