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!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail Message-ID: <48BF3A77.3070307@spam.acm.org> From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Possible compiler bug with this simple program 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> In-Reply-To: <5ca524f3-0fde-4c3b-b1a0-fe2281180ef3@k36g2000pri.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1220491896 12.201.97.213 (Thu, 04 Sep 2008 01:31:36 GMT) NNTP-Posting-Date: Thu, 04 Sep 2008 01:31:36 GMT Organization: AT&T ASP.att.net Date: Thu, 04 Sep 2008 01:31:36 GMT Xref: g2news1.google.com comp.lang.ada:1902 Date: 2008-09-04T01:31:36+00:00 List-Id: Jerry wrote: > > In about a hundred cases in this same binding project, I have passed > an unconstrained array (and its length) as a parameter to an Imported > C subprogram without consequence--no warnings, no errors, no hangs--on > several kinds of machines (32-bit and 64-bit). This seems to be > allowed by ARM B.3.70: "An Ada parameter of an array type with > component type T, of any mode, is passed as a t* argument to a C > function, where t is the C type corresponding to the Ada type T." > There is no restriction on unconstrained array types. Yes, but you're passing a pointer to an Ada convention-C subprogram to a C function, and C is calling that subprogram. The subprogram has a an unconstrained array parameter. This says nothing about what happens when C calls Ada. Ada needs to know what the lower bound of this array parameter is, and apparently your compiler is getting it wrong. Using a constrained array type 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. -- Jeff Carter "I fart in your general direction." Monty Python & the Holy Grail 05