* [Ada] Compiler loop on illegal nested accept statement
@ 2019-07-05 7:08 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2019-07-05 7:08 UTC (permalink / raw)
To: gcc-patches; +Cc: Ed Schonberg
[-- Attachment #1: Type: text/plain, Size: 1047 bytes --]
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;
Tested on x86_64-pc-linux-gnu, committed on trunk
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 567 bytes --]
--- gcc/ada/sem_ch9.adb
+++ 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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-07-05 7:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-05 7:08 [Ada] Compiler loop on illegal nested accept statement Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).