https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124179
Bug ID: 124179
Summary: asynchronous_select does not allow plain procedure as
triggering statement
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: liam at liampwll dot com
CC: dkm at gcc dot gnu.org
Target Milestone: ---
Created attachment 63731
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63731&action=edit
incomplete fix
I came across these two bugs when trying to mock an entry call. I'm just
opening one bug since they can both be fixed in the same place.
The first bug is that the below program incorrectly reports "triggering
statement must be procedure or entry call or delay statement". This error
message is poorly worded as procedure here means a renamed entry etc. from
9.7.2(3.2/2), but that's not the main issue as 9.7.2(3.2/2) does not apply to
asynchronous_select. At a glance it appears that it should, but 9.7.4(6/2)
explicitly allows for the triggering statement to be any procedure in its final
sentence. This whole error message looks like it can be removed so it does not
need to be reworded.
The second bug is that a null procedure as the triggering procedure causes a
bug box without the patch as it sneaks past the incorrect check in
Analyze_Triggering_Alternative.
A fix is attached but I do not believe it is entirely correct due to how Ecall
is modified directly above the changes in Exp_Ch9, specifically:
if Nkind (Ecall) = N_Block_Statement then
Ecall := First (Statements (Handled_Statement_Sequence (Ecall)));
...
Reproducer follows:
procedure Example is
-- procedure P is null;
-- Uncomment above to cause bug box without the patch or without
-- N_Null_Statement in the patch.
procedure P is
begin
null;
end P;
begin
select
P;
then abort
loop
delay 1.0;
end loop;
end select;
end Example;