comp.lang.ada
 help / color / mirror / Atom feed
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 22:40:21 +0100
Date: 2007-10-30T22:39:45+01:00	[thread overview]
Message-ID: <1193780421.3259.46.camel@kartoffel> (raw)
In-Reply-To: <1193775877.289991.52560@y27g2000pre.googlegroups.com>

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?


> But you're declaring an array object X of size 255*(2**40), which
> can't be handled on a machine with a 32-bit address space; so I'm
> confused about why you'd expect the program to work,

I didn't expect this program to work, really, other than through
advanced OS magic or due to my limited knowledge of Ada details.
Another compiler, though, targeting a 64bit platform, produces the
exact same output. So I hesitated to say that they both are producing
incorrect code for this case. But:

> Anyway, however, this looks like a
> compiler bug---if it is unable to generate correct code because of the
> array size, it should reject the program.

Thanks for explaining this.


Oh, there is more evidence as I write this. I don't have a recent GCC right
now to see whether this is still a bug; I'll try to build one, but if one
of you has a recent GCC and can reproduce the behavior, you'd be
saving me a few minutes this weekend :-) -Os was the crucial addition
to the command line.


kartoffel% gnatmake -W -gnatp -S -s -march=x86-64 -m64 -Os stk.adb
gcc-4.1 -c -W -gnatp -S -march=x86-64 -m64 -Os stk.adb
+===========================GNAT BUG DETECTED==============================+
| 4.1.2 (Ubuntu 4.1.2-0ubuntu4) (i486-pc-linux-gnu) GCC error:             |
| in pro_epilogue_adjust_stack, at config/i386/i386.c:5094                 |
| Error detected at stk.adb:41:5                                           |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Use a subject line meaningful to you and us to track the bug.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc-4.1 or gnatmake command that you entered.          |
| Also include sources listed below in gnatchop format                     |
| (concatenated together with no headers between files).                   |
+==========================================================================+

Please include these source files with error report
Note that list may not be accurate in some cases, 
so please double check that the problem can still 
be reproduced with the set of files listed.

stk.adb


raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:380
gnatmake: "stk.adb" compilation error





  reply	other threads:[~2007-10-30 21:40 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 [this message]
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