From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,caabf5265fad78e5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!q40g2000prh.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: unsigned type Date: Thu, 16 Jul 2009 08:12:08 -0700 (PDT) Organization: http://groups.google.com Message-ID: <341fc922-61c4-4217-8b5e-71cff1cc54da@q40g2000prh.googlegroups.com> References: <72cf874a-ebdc-4a19-9e05-ee9b9a3c245a@l28g2000vba.googlegroups.com> <59503098-8bd7-4553-9b87-560151327006@c36g2000yqn.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1247757128 14587 127.0.0.1 (16 Jul 2009 15:12:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 16 Jul 2009 15:12:08 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q40g2000prh.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7088 Date: 2009-07-16T08:12:08-07:00 List-Id: On Jul 16, 7:41=A0am, Martin wrote: > On Jul 16, 2:54=A0pm, a...@anon.org (anon) wrote: > > > The Slice rule RM 4.1.2 ( 7 ) does not stop a vendor from checking the > > bounds type first. In GNAT, using the last program I posted you will se= e that > > GNAT, first checks the lower bound type then checks for a "null range".= Which > > somewhat goes against the rule RM 4.1.2 ( 7 ). > > You are confusing what a particular compiler does with the language > specification - GNAT by simply be buggy. Right. I think that the issue here is that if the RM says something like "Constraint_Error is raised if X and Y are true", then it doesn't matter whether X or Y is checked first. BUT: If you can somehow tell from the results (not from examining the code or running it under a debugger) that Y is being checked first, then the implementation is wrong. The last two sentences of 4.1.2(7) are, as far as I can tell, equivalent to saying "Constraint_Error is raised if the slice is not a null slice *and* the bounds of the discrete_range do not belong to the index range of the array", so it's really irrelevant which of the two conditions separated by "and" is checked first---as long as the result is correct. If an implementation checks the "bounds belong to range" condition first, and raises Constraint_Error (or faults) if this check fails even if the "null slice" condition is true, then of course the implementation is wrong. However, I looked over the example program in the "getting back to null range" post and I couldn't see any evidence that GNAT is doing anything wrong. Part of the confusion there is that the program seemed to have an error; as Christoph pointed out, the programmer was using the value of an uninitialized variable in places where he thought he was specifying a null range. -- Adam