AI22-0094-1

!standard 10.2.1(9.1/5)                                    24-04-26  AI22-0094-1/03

!standard 11.4.2(28/5)

!standard 13.12(8.3/1)

!standard 13.12(9.1/1)

!class Binding Interpretation 24-02-12

!status work item 23-12-14

!status received 23-12-14

!priority Low

!difficulty Easy

!qualifier Clarification

!subject  Assertion policy and preelaborability

!summary

Confirm that assertion policy has no effect on preelaborability.

!issue

In the discussion of AI22-0051, it was pointed out that adding or deleting an Assertion_Policy pragma should not change the preelaborability of any elaborable construct.

!recommendation

State explicitly (as is already done in a similar case for freezing rules) that Assertion_Policy  pragmas are ignored in determining preelaborability, and that instead, all relevant assertion policies are assumed to be Check.

In 11.4.2, state the general principle that a (legal) Assertion_Policy pragma should have no effect on the legality or the static semantics of any construct.

A consequence of that general principle is that an Assertion_Policy pragma should not have an effect on the meaning of a restrictions pragma. That also is stated explicitly.

!wording

Add after 10.2.1(9.1/5):

In determining whether the elaboration of an elaborable construct performs some action, an assertion policy of Check is assumed to be in effect everywhere and for all assertion aspects.  [Redundant: Assertion_Policy pragmas are ignored in this determination.]

Add after 11.4.2(28/5)[a]:

NOTE 2: Adding or deleting a legal Assertion_Policy pragma has no impact on the legality or the static semantics of any construct. In particular, the rules pertaining to freezing (see 13.14), restrictions (see 13.12), and the definition of preelaborability (see 10.2.1) are unaffected by Assertion_Policy pragmas.

Add after 13.12(8.3/1) (as another bulleted list item):

Modify 13.12(9.1/1):

An implementation is permitted to omit restriction checks for code that is recognized at compile time to be unreachable and for which no code is generated {, subject to the aforementioned assumption that an Assertion_Policy of Check is in effect everywhere}.

AARM Discussion: This permission is not intended to allow omitting restriction checks for Ignored assertions.

!discussion

(See Recommendation.)

!example

package Example is

   pragma Preelaborate;

   pragma Assertion_Policy (Ignore);

   X : Integer := 111;

   Y : Integer := 222;
   pragma Assert (X < Y); -- Illegal: disabled assertion not preelaborable

end Example;

!ACATS test

A B-test similar to the example above would be appropriate; a B-Test of a restriction violation in an ignored pragma Assert is also needed.

!appendix


 

[a]Steve had this "in the Language Design Principles section". But that ends before this paragraph, and does not appear in the RM anyway. So either this should be an AARM note in a different place, or a user note given in the original place. I chose the latter.