CVS difference for ais/ai-00291.txt

Differences between 1.5 and version 1.6
Log of other versions for file ais/ai-00291.txt

--- ais/ai-00291.txt	2004/03/02 04:45:00	1.5
+++ ais/ai-00291.txt	2004/08/31 23:05:44	1.6
@@ -1,4 +1,4 @@
-!standard  4.09 (38)                                   03-09-17  AI95-00291/02
+!standard  4.09 (38)                                   04-08-31  AI95-00291/03
 !class binding interpretation 02-03-26
 !status work item 03-09-17
 !status received 02-03-26
@@ -9,6 +9,11 @@
 
 !summary
 
+The recommended level of support for representation clauses does not preclude
+maintaining the invariant that all objects of a given by-reference
+type and all aliased objects of any given type are consistently aligned and
+have a common representation.
+
 !question
 
 The recommended level of support for representation items should not
@@ -23,42 +28,49 @@
 
 !recommendation
 
+(See summary.)
+
 !wording
 
+Insert after 13.1(18.1/1)
+
+    A representation item that specifies the value for an aspect of
+    representation that would have been chosen in the absence
+    of the representation item is said to be *confirming*.
+
+Insert after 13.1(21) (i.e. as the first item in the bulleted list)
+
+    A confirming representation item should be supported.
+
 Replace 13.1(24) with
 
-    A representation item need not be supported if it could cause
-    an aliased object, a volatile object, or an object of a by-reference
+    An implementation need not support a nonconfirming representation item if
+    it could cause an aliased object or an object of a by-reference
     type to be allocated at a nonaddressable location or, if
-    the alignment attribute of the subtype of such an object is non-zero,
+    the alignment attribute of the subtype of such an object is nonzero,
     at an address which is not an integral multiple of that alignment.
 
-    A representation item need not be supported if it could cause
-    an aliased object or an object whose type is by-reference to have a
-    different size than some other such object of the same definite subtype
-    unless that subtype is discriminated and unconstrained.
-
-    A representation item that specifies the default value for an aspect of
-    representation (i.e. the value that would have been chosen in the absence
-    of the representation item) is said to be *confirming*. A confirming
-    representation item should be supported.
-
-    A nonconfirming subtype-specific representation item specifying an aspect
-    of representation of an indefinite subtype need not be supported.
-
-Insert after 13.1(24)
-    NOTES
-
-    The determination of whether a representation item which applies to a type
-    "could cause" an object to have some property should be based solely on the
-    properties of the type itself, not on any available information about how
-    the type is used. In particular, it should be assumed that minimally aligned
-    objects of this type are declared at some point.
+    An implementation need not support a nonconfirming representation item
+    if it could cause an aliased object or an object whose type is by-reference
+    to have a different size than some other such object of the same definite
+    subtype.
+
+    For purposes of these rules, the determination of whether a representation
+    item applied to a type "could cause" an object to have some property
+    should be based solely on the properties of the type itself, not on any
+    available information about how the type is used. In particular, it should
+    be assumed that minimally aligned objects of this type are declared at
+    some point.
+
+    An implementation need not support a nonconfirming subtype-specific
+    representation item specifying an aspect of representation of an
+    indefinite or abstract subtype.
 
 Insert after 13.2(6):
 
-    If an object of a packed type has a component which is neither aliased nor
-    of a by-reference type, then that component need not be allocated at
+    If an object of a packed type has a component which is not
+    of a by-reference type, is not aliased, and has no aliased part,
+    then that component need not be allocated at
     an addressable location whose address is an integral multiple of the
     Alignment of the component's subtype.
 
@@ -68,16 +80,37 @@
      cross aligned word boundaries to improve the packing".
 
 Delete 13.3(18)
+
+Following formatting of 13.3(39/1 - 48), replace 13.3(22/1 - 26) with
+
+    For a prefix X that denotes an object:
+
+    X'Alignment
+
+    The value of this attribute is of type *universal_integer*, and
+    nonnegative; zero means that the object is not necessarily aligned
+    on a storage element boundary. If X'Alignment is not zero,
+    then X is aligned on a storage unit boundary
+    and X'Address is an integral multiple of X'Alignment (i.e. the
+    Address modulo the Alignment is zero).
+
+    Alignment may be specified for stand-alone objects via an
+    attribute_definition clause; the expression of such a clause shall
+    be static, and its value nonnegative.
+
+    For every subtype S:
 
-Replace 13.3(23), sentence 1
-    "The address of an object that is allocated under control of the
-    implementation is an integral multiple of the Alignment of the
-    object (that is, the Address modulo the Alignment is zero)."
-  with
-     "<same as before> ... is zero), unless specified otherwise by
-     a representation item."
+    S'Alignment
 
-Insert after 13.3(26)
+    The value of this attribute is of type *universal_integer*, and
+    nonnegative.
+
+    For an object X of subtype S, if S'Alignment is not zero, then
+    X'Alignment is a non-zero integral multiple of S'Alignment unless
+    specified otherwise by a representation item (e.g. a Size_Clause,
+    a component_clause, a Component_Size clause, or a Pack pragma).
+
+Insert after 13.3(25) (note that AI247 deleted 13.3(26))
     An implementation need not support Alignments specified for a
     derived tagged type which are not multiples of the Alignment
     of the type's parent type. An implementation need not support
@@ -89,27 +122,36 @@
     aliased or volatile subcomponents if the specified Alignment is not
     a multiple of the Alignment of the object's subtype.
 
+Replace 13.3(28) with
+
+    For an object X that is not allocated under control of the
+    implementation (e.g. one that is imported, that is allocated by
+    a user-defined allocator, whose Address has been specified, or is
+    designated by an access value returned by an instance of
+    Unchecked_Conversion), execution is erroneous if X'Alignment is
+    not zero and X'Address is not an integral multiple of X'Alignment.
+
 In 13.3(43) replace
     "A Size clause should be supported for an object if ..."
 with
     "A Size clause should be supported for an object (excepting
-    aliased objects, volatile objects, and objects of by-reference types)
-    if ..."
+    aliased objects and objects of by-reference types) if ..."
 
 Insert after 13.3(56)
     A nonconfirming size clause for the first subtype of a
     derived untagged by-reference type need not be supported.
 
+Insert after 13.3(72):
+    An implementation need not support a nonconfirming Component_Size
+    clause if the array type has a by-reference or aliased part.
+
 In 13.5.1(19), replace
     "A storage place should be supported" with "A storage place for
-    an unaliased nonvolatile component should be supported".
+    an unaliased component should be supported".
 
-Insert after 13.3(72):
-    An implementation need not support a nonconfirming Component_Size
-    clause if the array type has a by-reference, aliased, or volatile part.
 
+!discussion
 
-!Discussion
 We do not want to *require* that implementations reject problematic
 representation items such as
 
@@ -119,7 +161,6 @@
 ; we just want to *allow* implementations to reject such beasts without
 running afoul of C.2(2).
 
-
 Note that the term "object" includes the case of a component. Thus, for
 example, the allowed non-support of a representation clause which could result
 in a misaligned object would imply permission to reject something like
@@ -140,9 +181,11 @@
           F at Integer'Alignment / 2 range 0 .. Integer'Size - 1;
        end record;
 
-!wording
-
-!discussion
+Given an object X of subtype S, X'Alignment must be consistent with
+S'Alignment "unless specified otherwise by a representation item".
+Note that the representation item need not be an alignment clause.
+It could be a Pack pragma, a Component_Size specification, a record
+representation clause, a size clause, etc.
 
 !ACATS test
 

Questions? Ask the ACAA Technical Agent