From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 24 Jul 93 17:13:24 GMT From: pipex!sunic!news.funet.fi!funic!news.eunet.fi!prime!mits!rkaivola@uunet.u u.net (Risto Kaivola) Subject: Re: Forcing default representations Message-ID: List-Id: crispen@eight-ball.boeing.com (Bob Crispen) writes: >And, definitely non-trivially, can someone explain why some compilers >approve of (and even generate proper code for) the following: > type Four_Bytes is range 0..31; > ... > for X use > record > Y at 0 range Four_Bytes; > ... > end record; >and some don't? > Bob Crispen I think that a compiler that accepts this is definitely broken. According to the relevant chapter (13.4) of the RM, a component clause is defined as (omitting the italicised prefixes which do not reflect any syntactic categories, but are there to provide information to the human reader) component_clause ::= name AT simple_expression RANGE range; In 3.5 we find that (again substituting attribute for _attribute) range ::= attribute | simple_expression .. simple_expression Actually, according to AI-00498, a range attribute is not allowed in a component clause, and this fact is reflected in the Annotated Ada Reference Manual for Ada9X. But in your example, Four_Bytes does not even fall into the syntactic category attribute! I wonder what the bug causing this behaviour is. Probably the implementation simplifies its job by sort-of 'reusing' some of the code it uses in other situations of this sort, erroneusly. -- Risto Kaivola (Internet address: rkaivola@mits.mdata.fi)