comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Possible compiler bug with this simple program
Date: Thu, 4 Sep 2008 07:35:18 -0700 (PDT)
Date: 2008-09-04T07:35:18-07:00	[thread overview]
Message-ID: <96185a5f-f543-4207-845b-48ddce7e9b50@k36g2000pri.googlegroups.com> (raw)
In-Reply-To: 48BF3A77.3070307@spam.acm.org

On Sep 3, 6:31 pm, "Jeffrey R. Carter"
<spam.jrcarter....@spam.acm.org> 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



  reply	other threads:[~2008-09-04 14:35 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
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 [this message]
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