From: Adam Beneschan <adam@irvine.com>
Subject: Re: Largest size array in Gnat 2005 for the PC?
Date: Tue, 30 Oct 2007 14:48:45 -0700
Date: 2007-10-30T14:48:45-07:00 [thread overview]
Message-ID: <1193780925.196642.17450@i38g2000prf.googlegroups.com> (raw)
In-Reply-To: <1193780421.3259.46.camel@kartoffel>
On Oct 30, 2:40 pm, Georg Bauhaus <rm.tsoh+bauh...@maps.futureapps.de>
wrote:
> On Tue, 2007-10-30 at 13:24 -0700, Adam Beneschan wrote:
> > On Oct 30, 12:26 pm, Georg Bauhaus <rm.tsoh
> > > Is there a bug in the following program or maybe I'm just dense?
>
> > EAX is a 32-bit register, right?
>
> Yes, i686 Linux in this case. When I ask the compiler for
> 64bit code, then I see occurrences of $280375465082880,
> which is 2**48 - 2**40.
>
> > So to assign into the first element of Fst, the offset from the
> > beginning of the array is 0; to assign into the last element, the
> > offset will be (2**48 - 2**40) which is 255 * 2**40, which is way too
> > big to fit into a 32-bit register, so apparently the compiler is
> > truncating to 0 before setting EAX.
>
> Ah, yes. Could exceeding size have produced the -1 in
> -1(%ebp,%eax), %eax
> too? It is
> -10002(%ebp,%eax), %eax
> for the "normal size" array of 10_000 elements?
Your array is 10_001 elements, actually. I haven't studied code
produced by GNAT very much, but -1 just looks like the starting point
for where things are allocated (downward) from the current stack frame
pointer (EBP); exceeding size would have produced -1 in that if the
compiler truncates the array size and thinks the size is 0, then the
resulting offset would have been -1. I'll bet that if you declared an
array of one byte, you would have seen -2(%ebp,%eax); if it were two
bytes, -3(%ebp,%eax), and so on. I'm just speculating, though... I
haven't tried this myself.
-- Adam
next prev parent reply other threads:[~2007-10-30 21:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-30 4:00 Largest size array in Gnat 2005 for the PC? ME
2007-10-30 7:08 ` Martin Krischik
2007-10-30 12:27 ` Florian Weimer
2007-10-30 14:16 ` ME
2007-10-30 14:47 ` Pascal Obry
2007-10-30 18:58 ` Martin Krischik
2007-10-31 5:38 ` ME
2007-10-30 16:07 ` virtual memory, was " tmoran
2007-10-30 19:17 ` Martin Krischik
2007-10-30 20:35 ` Ludovic Brenta
2007-10-31 5:53 ` ME
2007-10-30 7:28 ` Pascal Obry
2007-10-30 9:47 ` Ludovic Brenta
2007-10-30 19:26 ` Georg Bauhaus
2007-10-30 20:17 ` Adam Beneschan
2007-10-30 22:53 ` tmoran
2007-10-30 23:39 ` Georg Bauhaus
2007-10-30 20:24 ` Adam Beneschan
2007-10-30 21:40 ` Georg Bauhaus
2007-10-30 21:48 ` Adam Beneschan [this message]
2007-10-30 21:50 ` Georg Bauhaus
2007-10-30 13:50 ` ME
2007-10-30 14:44 ` Pascal Obry
2007-10-30 15:00 ` Stefan Bellon
2007-10-30 15:16 ` Pascal Obry
2007-10-30 15:22 ` Stefan Bellon
2007-10-31 5:52 ` ME
2007-10-31 9:22 ` Stefan Bellon
2007-10-31 13:33 ` ME
2007-10-31 14:36 ` Stefan Bellon
2007-10-30 17:27 ` anon
2007-10-30 19:06 ` Adam Beneschan
2007-10-31 6:32 ` anon
2007-11-01 4:13 ` ME
2007-11-01 8:44 ` Stefan Bellon
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox