Version 1.3 of ai22s/ai22-0013-2.txt
!standard 5.1(12.1/3) 22-02-03 AI22-0013-2/02
!standard 2.8(12)
!class binding interpretation 22-01-22
!status Corrigendum 1-2022 22-02-03
!status WG9 Approved 22-10-18
!status ARG Approved 16-0-0 22-02-03
!status work item 22-01-22
!status received 21-06-23
!priority Low
!difficulty Easy
!qualifier Clarification
!subject Pragma after a final label
!summary
A pragma is permitted after a label, even if there are no statements following
the label. More generally, a pragma in the place of a statement is treated as
a statement by other rules of the language.
!issue
Is the following legal:
begin
if Some_Test then
goto label;
end if;
Do_This;
Do_That;
<<label>>
pragma Assert (X = Y);
end;
(Yes.)
!recommendation
A pragma is allowed immediately after a label, even if there are no statements
after the label. This is a ramification of 2.8(7.1/3) which says that a pragma
is allowed:
* In place of a statement in a sequence_of_statements.
Clearly if the pragma in the example above were replaced with a statement it
would be syntactically legal, so that implies the pragma is legal even if
there are no statements following it.
However, there is other wording that depends on a statement following a label.
In particular, a goto statement jumps to a target statement rather than a
target label, and for that reason, the change to allow a label at the end of
a sequence of statements introduced the notion of an implicit null statement
in 5.1(12.1/3):
If one or more labels end a sequence_of_statements, an implicit
null_statement follows the labels before any following constructs.
One way to solve this is to say that a pragma that is used in the place of a
statement is treated as a statement.
!wording
Modify 2.8(12):
Any pragma that appears at the place of an executable construct is executed{,
and is treated for the purposes of other rules of the language as being of
the same sort of executable construct}. Unless otherwise specified for a
particular pragma, this execution consists of the evaluation of each
evaluable pragma argument in an arbitrary order.
!discussion
It seems clear that a pragma immediately after a label makes sense, no matter
where the label might be. The current wording for placement of pragmas already
allows that, so this requires no change.
However, the existing wording for goto statements talks about a target
statement, and that becomes more confusing if that target statement is
actually a pragma. Hence, we propose to say that a pragma is treated as a
statement when used in the place of a statement, and similarly for any other
construct that it effectively replaces.
!corrigendum 2.8(12)
Replace the paragraph:
Any pragma that appears at the place of an executable construct is executed.
Unless otherwise specified for a
particular pragma, this execution consists of the evaluation of each
evaluable pragma argument in an arbitrary order.
by:
Any pragma that appears at the place of an executable construct is executed,
and is treated for the purposes of other rules of the language as being of
the same sort of executable construct. Unless otherwise specified for a
particular pragma, this execution consists of the evaluation of each
evaluable pragma argument in an arbitrary order.
!ACATS test
An ACATS C-Test should try an example similar to that in the !question.
!appendix
See the !appendix of AI22-0013-1 for the mail thread that led to this
solution.
****************************************************************
Questions? Ask the ACAA Technical Agent