From: Jerry <lanceboyle@qwest.net>
Subject: Re: Possible compiler bug with this simple program
Date: Fri, 29 Aug 2008 21:47:57 -0700 (PDT)
Date: 2008-08-29T21:47:57-07:00 [thread overview]
Message-ID: <8c8e5e62-16e1-4442-a6e9-f4e63fbed7a8@a8g2000prf.googlegroups.com> (raw)
In-Reply-To: g9a656$d8o$1@jacob-sparre.dk
On Aug 29, 6:00 pm, "Randy Brukardt" <ra...@rrsoftware.com> wrote:
> "Jerry" <lancebo...@qwest.net> wrote in message
>
> news:97b1150b-cb8f-4972-b594-2ae59af84147@x16g2000prn.googlegroups.com...
> ...
>
> >FWIW, in the _real_ application that I am working on, plmap is written
> >in C (and accessed from my binding by an Import).
>
> Interestingly, that's completely different. That *should* work on all Ada
> compilers (note that the wording specifically excludes unconstrained
> parameters for pragma Import).
>
> This example program is unportable garbage, unfortunately, because of
> AI05-0002-1, and also because of B.1(38.1/2) (the "buyer beware" clause:
> there is no requirement that an Ada program actually work as expected if you
> force its conventions to another language (like C).
>
> Admittedly, this is a bit strange. In this case, C works fine as the
> receiver of such a call because it has no need to know the bounds of the
> array passed. (And if it does, they're going to be passed explicitly.) But
> Ada does need to know those bounds, and you can't even pass them explicitly
> because the Ada compiler will have to assume something for the lower bound
> in order to generate indexing operations (and that may be different than
> what you intended).
>
> The net effect is that the example program doesn't prove anything useful. It
> would need to import an actual C subprogram in order to be a useful test.
>
> Randy.
OK--this clears things up for me. And possibly validates the reason I
wrote the _real_ application the way that I did, thinking that C
arrays always starts from 0 so passing the length along as a separate
parameter should work.
But it looks like in testing (and posting) an all-Ada example I
muddied the situation--or worse--used a completely different example
from what my original code was.
I'll see if I can make another example where plmap is a simple program
in C that is Import-ed and see if it bombs on a 64-bit computer.
Jerry
next prev parent reply other threads:[~2008-08-30 4:47 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-28 7:28 Possible compiler bug with this simple program Jerry
2008-08-28 7:56 ` Ludovic Brenta
2008-08-28 21:08 ` Jerry
2008-08-29 20:39 ` Ludovic Brenta
2008-08-29 21:20 ` Jerry
2008-08-29 21:31 ` Jerry
2008-09-02 22:10 ` Santiago Urueña
2008-08-28 8:03 ` Niklas Holsti
2008-08-28 15:54 ` Adam Beneschan
2008-08-28 15:56 ` Adam Beneschan
2008-08-28 21:01 ` Randy Brukardt
2008-08-28 21:29 ` Jerry
2008-08-30 1:00 ` Randy Brukardt
2008-08-30 4:47 ` Jerry [this message]
2008-09-01 11:19 ` Jerry
2008-09-03 4:22 ` Jerry
2008-09-03 14:20 ` Adam Beneschan
2008-09-04 0:22 ` Jerry
2008-09-04 1:18 ` Adam Beneschan
2008-09-04 3:53 ` Randy Brukardt
2008-09-04 1:31 ` Jeffrey R. Carter
2008-09-04 14:35 ` Adam Beneschan
2008-09-04 14:42 ` Jacob Sparre Andersen
2008-09-06 3:03 ` Jerry
2008-09-05 8:17 ` Ludovic Brenta
2008-09-05 15:56 ` Adam Beneschan
2008-09-05 17:09 ` Jeffrey R. Carter
2008-09-04 20:49 ` Simon Wright
2008-08-28 21:16 ` Jerry
2008-08-29 7:41 ` Niklas Holsti
2008-08-30 0:50 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox