Version 1.1 of ai05s/ai05-0077-1.txt

Unformatted version of ai05s/ai05-0077-1.txt version 1.1
Other versions for file ai05s/ai05-0077-1.txt

!standard 13.9(7)          07-12-06 AI05-0070-1/01
!class binding interpretation 07-12-06
!status work item 07-12-06
!status received 07-11-15
!priority Low
!difficulty Easy
!qualifier Clarification
!subject Alignment need not match for Unchecked_Conversion
!summary
The alignment of the source object of an unchecked conversion need only be a multiple of that of the target type for unchecked conversion to have a defined result.
!question
13.9(7) specifies that it is required that the source object and target type have identical alignment for an unchecked type conversion to have an language-defined effect.
The intent of this rule appears to be to restrict the cases where an unchecked conversion has a language-defined effect to situations where the source object representation is valid with respect to the target type's alignment (allowing the representation of the source object to be viewed as a correctly aligned representation of a value of the target type).
This rule disallows cases which would still meet this intent. It would be sufficient for S'Alignment to be any multiple of Target'Alignment.
Should this clause be changed? (Yes.)
!recommendation
(See Summary.)
!wording
Replace 13.9(7) with:
S'Alignment is a multiple of Target'Alignment.
!discussion
Implementations are allowed to support unchecked conversions with mismatched alignments even without this language change (implementation-defined surely includes working as expected). So this language change only provides a bit of additional portability.
!corrigendum 13.9(7)
Replace the paragraph:
by:
!ACATS Test
This might be testable, but it is likely that this would work anyway.
!appendix

!topic 13.9(7) is unnecessarily restrictive
!reference Ada 2005 RM 13.9(7)
!from Thomas Quinot 2007-11-15
!keywords unchecked conversion, alignment
!discussion

13.9(7) specifies that it is required that the source object and target
type have identical alignment for an unchecked type conversion to have
an RM-defined effect.

As I understand this clause, the intent of the clause is to restrict
the scope of 13.9(5) (case where an unchecked conversion has a
language-defined effect) to situations where the source object
representation is valid with respect to the target type's alignment
(allowing the representation of the source object to be viewed as a
correctly aligned representation of a value of the target type).

With respect to this intent, the restriction stated in 13.9(7) is a
sufficient, but not necessary, condition. It would be sufficient for
S'Alignment to be any multiple of Target'Alignment. So, I am suggesting
that this clause be changed to:

13.9(7) S'Alignment is a multiple of Target'Alignment

****************************************************************

From: Tucker Taft
Sent: Thursday, November 15, 2007  7:25 AM

Your suggestion makes good sense to me.

****************************************************************

Questions? Ask the ACAA Technical Agent