CVS difference for ai12s/ai12-0393-1.txt

Differences between 1.1 and version 1.2
Log of other versions for file ai12s/ai12-0393-1.txt

--- ai12s/ai12-0393-1.txt	2020/09/04 00:12:18	1.1
+++ ai12s/ai12-0393-1.txt	2020/09/11 22:24:01	1.2
@@ -1,5 +1,7 @@
-!standard 4.9(24/5)                                   20-09-03  AI12-0393-1/01
+!standard 4.9(24/5)                                   20-09-10  AI12-0393-1/02
 !class binding interpretation 20-09-03
+!status Amendment 1-2012 20-09-10
+!status ARG Approved 14-0-0  20-09-09
 !status work item 20-09-03
 !status received 20-07-06
 !priority Low
@@ -25,9 +27,8 @@
 in the context of a static predicate, and it seems worth re-opening, and 
 coming to the conclusion that such a constant is not static. However, we plan 
 to retain this as a pathology, since there was an ACATS test (ACATS test 
-C490001) which required treating such a constant object as static. Because we 
-believe this is a pathology, this test should be withdrawn rather than be 
-changed to require the opposite behavior.
+B490001) which required declaring such a constant object as static, which
+forced implementers to make a choice.
 
 !wording
 
@@ -50,19 +51,48 @@
 constraints or its predicates.
 
 To aid implementors, we are promising not to test this, as the RM was ambiguous 
-before, and there was an ACATS test that required the opposite choice. 
-Additionally, in most cases, the original "static" object that did not satisfy 
-a constraint or predicate would raise an exception at runtime, so code using 
-would never be  executed, and thus how it could be used is not relevant.
+before, and there was an ACATS test that required allowing such a declaration
+and thus required making a choice as to whether or not the object was static.
 
+A compiler survey of Ada 95 compiler reported in AI12-0108-1 noted that
+implementers were almost evenly split on the question of whether this object
+is static, as one might expect when the RM gives no answer to the question.
+Moreover, as the ACATS test has been in the test suite since 1996, this split
+has not produced significant portability problems in practice.
+Additionally, this fix would be incompatible for existing implementations that
+treated the constant as static (making previously legal code illegal, even 
+if it never is executed), potentially impacting their customers. Such code
+is very possible in conditionally compiled code; enforcement of legality rules
+on static expressions enforced on such code is a known problem with Ada.
+
+Finally, in most cases, the original "static" object that did not satisfy 
+a constraint or predicate would raise an exception at run time, so code using 
+it would never be executed, and thus how it could be used is not relevant.
+
+For all of these reasons, requiring implementers to expend effort on fixing 
+this seems counter-productive.
+
+!corrigendum 4.9(24/5)
+
+@drepl
+A @i<static constant> is a constant view declared by a full constant
+declaration or an @fa<object_renaming_declaration> with a static nominal subtype,
+having a value defined by a static scalar expression or by a static string
+expression.
+@dby
+A @i<static constant> is a constant view declared by a full constant
+declaration or an @fa<object_renaming_declaration> with a static nominal subtype,
+having a value defined by a static scalar expression or by a static string
+expression, and which satisfies any constraint or predicate that applies to 
+the nominal subtype.
+
 !ASIS
 
 No ASIS effect.
 
 !ACATS test
 
-No ACATS test should be created for this, and the existing C490001 should be
-withdrawn or modified to remove this case.
+No ACATS test should be created for this case.
 
 !appendix
 
@@ -256,3 +286,27 @@
 
 ****************************************************************
 
+Editor's note (9/10/20): I was asked to check the ACATS test that is related 
+to this test. The named test (C490001) does not appear to have anything to do
+with static expressions. That test was named in AI12-0108-1 and was not 
+checked when this AI was created.
+
+After investigation, it appears that the declarations
+
+   SubInt1 : constant My_Int_Sub := -128;                             -- OK.
+                                 -- But raises Constraint_Error at run-time.
+
+   SubInt3 : constant My_Int_Sub := 115;                              -- OK.
+                                 -- But raises Constraint_Error at run-time.
+
+on lines 321 through 325 of test B490001 is what is referred to in this
+AI. Note that these declarations are never used later in the test so whether
+or not they are static is not determined by the test. Thus it does not require
+a particular choice to the question, but rather it requires implementers to
+decide the question on their own. 
+
+A compiler survey of Ada 95 compilers reported in AI12-0108-1 showed that
+implementers split almost evenly on the answer to the question. The AI text 
+was updated to reflect this.
+
+****************************************************************

Questions? Ask the ACAA Technical Agent