From: Georg Bauhaus <rm.tsoh+bauhaus@maps.futureapps.de>
Subject: Re: Largest size array in Gnat 2005 for the PC?
Date: Tue, 30 Oct 2007 20:26:42 +0100
Date: 2007-10-30T20:26:07+01:00 [thread overview]
Message-ID: <1193772402.13888.130.camel@kartoffel> (raw)
In-Reply-To: <1193737660.539205.271270@57g2000hsv.googlegroups.com>
On Tue, 2007-10-30 at 02:47 -0700, Ludovic Brenta wrote:
> Pascal Obry wrote:
> > ME a crit :
> >
> > > What is the largest array (in storage units) that you can declare in Gnat
> > > 2005 for the PC?
> In short, the answer is: "it depends" :)
Indeed, it depends;-) I thought that declaring an array *type*
of enormous size is not a problem, since there is no object
yet. It isn't a problem. So maybe using portions of the array might
work (when the program is not actually using physical memory.)
I get unexpected results,though, but they are consistently produced
by two unrelated compilers targeting two (seemingly unrelated)
machines!
This is the only hint I have found in the assembly
listing; '?' is $63, '!' is $33, this is for the lines
assigning Fst and Lst in the second declare block below.
Notice the -1 for the stack offset
movl $0, %eax
movb $33, -1(%ebp,%eax) -- ( Fst := '!' )
movl $0, %eax
movb $63, -1(%ebp,%eax) -- ( Lst := '?' )
Is there a bug in the following program or maybe I'm just dense?
with Ada.Text_IO;
procedure stk is
use Ada;
type Big_Index is range 0 .. 2**50;
type A is array (Big_Index range <>) of Character;
begin
-- output is "!?"
declare
X: A (Big_Index range 2**40 .. 2**40 + 10_000);
Fst: Character renames X(X'First);
Lst: Character renames X(X'Last);
begin
Fst := '!';
Lst := '?';
Text_IO.Put(Fst);
Text_IO.Put(Lst);
Text_IO.New_Line;
end;
-- output is "??"
declare
X: A (Big_Index range 2**40 .. 2**48);
Fst: Character renames X(X'First);
Lst: Character renames X(X'Last);
begin
Fst := '!';
Lst := '?';
pragma assert(Fst = '!');
Text_IO.Put(Fst);
Text_IO.Put(Lst);
Text_IO.New_Line;
end;
end stk;
next prev parent reply other threads:[~2007-10-30 19:26 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 [this message]
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
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