comp.lang.ada
 help / color / mirror / Atom feed
From: pipex!sunic!news.funet.fi!funic!news.eunet.fi!prime!mits!rkaivola@uunet.u u.net  (Risto Kaivola)
Subject: Re: Forcing default representations
Date: 24 Jul 93 17:13:24 GMT	[thread overview]
Message-ID: <rkaivola.743534004@mits> (raw)

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 <range>_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)

             reply	other threads:[~1993-07-24 17:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-07-24 17:13 pipex!sunic!news.funet.fi!funic!news.eunet.fi!prime!mits!rkaivola [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-07-30 12:00 Forcing default representations Bob Gilbert
1993-07-30  1:15 pipex!warwick!zaphod.crihan.fr!univ-lyon1.fr!scsing.switch.ch!epflnews!di
1993-07-26 18:30 Robert I. Eachus
1993-07-26 15:12 agate!howland.reston.ans.net!europa.eng.gtefsd.com!news.ans.net!newsgate.watson.ibm.com!yktnews.watson.ibm.com!ncohen
1993-07-24 21:16 Erik Magnuson
1993-07-23 19:15 Gary Morris @ignite
1993-07-22 18:34 Bob Crispen
1993-07-20 12:57 Bob Crispen
1993-07-19 16:56 Adam Beneschan
1993-07-16 22:26 dog.ee.lbl.gov!overload.lbl.gov!agate!howland.reston.ans.net!noc.near.net
1993-07-13 19:22 crispen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox