From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,49eb370bfd3baa90 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newscon02.news.prodigy.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Memory limits in Ada where Fortran has none Date: 16 Mar 2005 14:51:26 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1110070479.250902.220540@l41g2000cwc.googlegroups.com> NNTP-Posting-Host: shell01-e.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1111002686 24578 69.38.147.31 (16 Mar 2005 19:51:26 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 16 Mar 2005 19:51:26 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:9515 Date: 2005-03-16T14:51:26-05:00 List-Id: "Dr. Adrian Wrigley" writes: > On Sun, 06 Mar 2005 19:05:21 -0500, Robert A Duff wrote: > > > The following works for me: > > > > package Test_Pkg is > > X: array (1..400_000_000) of Integer := (others => 999); > > end Test_Pkg; > > > > with Test_Pkg; use Test_Pkg; > > with Text_IO; use Text_IO; > > procedure Test is > > begin > > Put_Line(Integer'Image(X(X'Last))); > > end Test; > > I am very wary of a test like this because GNAT sometimes > silently accesses the wrong element of very large data, if I > remember correctly. Well, the original poster was complaining that you can't allocate large amounts of memory in Ada, but you can in Fortran, and I was just trying to test that. But, OK, how about this: package Test_Pkg is pragma Elaborate_Body; X: array (1..400_000_000) of Integer := (others => 999); end Test_Pkg; package body Test_Pkg is begin for I in X'Range loop X(I) := Integer'Last - I; end loop; end Test_Pkg; with Test_Pkg; use Test_Pkg; with Text_IO; use Text_IO; procedure Test is begin for I in X'Range loop pragma Assert(X(I) = Integer'Last - I); null; end loop; Put_Line(Integer'Image(X(X'Last))); end Test; Works fine, for me. Takes quite a while to run, of course, since I don't have that much RAM on my machine. >... A correctly written program can (and did!) > thus fail catastrophically. Large records in particular are > suspect (on GNAT 3.15p, x86). (I have no test case to hand > at the moment). I don't know if it is affected by -gnato > and default absence of overflow checking. I guess you should send them a bug report. > A more comforting test would place a *different* value at > each location, and check they are all correct! OK, the above example does that (but it's an array, not a record). - Bob