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: 103376,e5a3abec221df39 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!k36g2000pri.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Possible compiler bug with this simple program Date: Thu, 4 Sep 2008 07:35:18 -0700 (PDT) Organization: http://groups.google.com Message-ID: <96185a5f-f543-4207-845b-48ddce7e9b50@k36g2000pri.googlegroups.com> References: <1edc3682-855f-405b-8348-72b423377b1a@i20g2000prf.googlegroups.com> <48b65b3b$0$25384$4f793bc4@news.tdc.fi> <97b1150b-cb8f-4972-b594-2ae59af84147@x16g2000prn.googlegroups.com> <8c8e5e62-16e1-4442-a6e9-f4e63fbed7a8@a8g2000prf.googlegroups.com> <903354c9-7780-4843-a5a3-dd2c40903d40@p31g2000prf.googlegroups.com> <2da4989c-4c97-43e9-8102-ba99389fdea9@v16g2000prc.googlegroups.com> <0494a60a-a452-436b-86f9-844b398aab4f@b38g2000prf.googlegroups.com> <5ca524f3-0fde-4c3b-b1a0-fe2281180ef3@k36g2000pri.googlegroups.com> <48BF3A77.3070307@spam.acm.org> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1220538919 28618 127.0.0.1 (4 Sep 2008 14:35:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 4 Sep 2008 14:35:19 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k36g2000pri.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:1913 Date: 2008-09-04T07:35:18-07:00 List-Id: On Sep 3, 6:31 pm, "Jeffrey R. Carter" wrote: > Ada needs to know what the lower bound of this array parameter is, and > apparently your compiler is getting it wrong. One other thing that probably ought to be mentioned: It's possible that the compiler is trying to determine the lower bound by looking at some memory location where it expects the lower bound to be, but in reality (since the Ada routine is being called from C) contains a random value previously used for something else. My experience is that memory locations with random values contain zero a high percentage of the time, so it would make sense that the program would happen to work on some platforms, or on some targets. If I understood the original post correctly, the program seemed to be working on some platforms but not others, and it could well be because of this random factor. It doesn't mean the compiler or the program were correct on those platforms. > Using a constrained array type or subtype, I think. > with a lower bound of zero and an upper bound as large or larger than can occur > would be the best choice for this situation. -- Adam