From: "braver" <deliverable@gmail.com>
Subject: Re: Memory limits in Ada where Fortran has none
Date: 6 Mar 2005 21:55:59 -0800
Date: 2005-03-06T21:55:59-08:00 [thread overview]
Message-ID: <1110174959.536952.153940@l41g2000cwc.googlegroups.com> (raw)
In-Reply-To: <bf2n21pi11c5r3kau9885d9d5khifnuhl7@4ax.com>
Now, this is an interesting experiment:
Fortran:
C-----
PARAMETER (NMAX=100 000 000)
COMMON /CA/A
INTEGER A
DIMENSION A(NMAX)
END
C-----
Ada: we have a package Lord_Fortran and the main procedure Import:
package Lord_Fortran is
A: array (Positive range 1..67_000_000) of Integer;
pragma Import(Fortran, A, "ca_");
pragma Suppress(Index_Check, On=> A);
end Lord_Fortran;
with Text_IO; use Text_IO;
with Lord_Fortran; use Lord_Fortran;
procedure Import is
package IO_Integer is new Integer_IO(Integer); use IO_Integer;
NMAX: constant Positive := 100_000_000;
S: Natural := 0;
pragma Suppress(All_Checks, A);
begin
Put_Line("Lord Fortran, we bow before thee!");
for I in 1..NMAX loop
A(I) := I;
if I mod 1_000_000 = 0 then
Put('.');
-- Put(I);
end if;
end loop;
New_Line;
Put_Line("Allright!");
S := A(68_000_000);
Put(Integer'Image(S));
New_Line;
end Import;
Depending on the index value at (1), I get the following results...
When running as above:
alexy@angle:/bk/ada/import > ./import
Lord Fortran, we bow before thee!
....................................................................................................
Allright!
raised CONSTRAINT_ERROR : import.adb:25
(There's a hundred dots, as expected!)
If the index is NMAX, then (same as above but the exception):
...
Allright!
raised STORAGE_ERROR : stack overflow (or erroneous memory access)
When 67_000_000, prints it. Strangely, doesn't come close enough to
67_108_864...
Cheers,
Alexy
next prev parent reply other threads:[~2005-03-07 5:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-06 0:54 Memory limits in Ada where Fortran has none braver
2005-03-06 1:09 ` Jeff C
2005-03-06 6:18 ` braver
2005-03-06 9:26 ` Martin Krischik
2005-03-06 16:14 ` braver
2005-03-06 16:28 ` Jeff C
2005-03-06 23:09 ` Craig Carey
2005-03-07 0:36 ` braver
2005-03-07 5:55 ` braver [this message]
2005-03-08 5:35 ` braver
2005-03-06 14:09 ` Stephen Leake
2005-03-06 9:33 ` Martin Krischik
2005-03-06 22:13 ` Gerald
2005-03-06 23:01 ` Dr. Adrian Wrigley
2005-03-07 0:31 ` braver
2005-03-07 12:47 ` Dr. Adrian Wrigley
2005-03-07 9:41 ` Martin Krischik
2005-03-07 11:59 ` Dr. Adrian Wrigley
2005-03-07 12:26 ` Martin Krischik
2005-03-07 0:05 ` Robert A Duff
2005-03-07 18:04 ` braver
2005-03-16 19:41 ` Robert A Duff
2005-03-17 18:49 ` Martin Krischik
2005-03-08 11:24 ` Dr. Adrian Wrigley
2005-03-09 3:39 ` Craig Carey
2005-03-16 17:39 ` Craig Carey
2005-03-16 19:51 ` Robert A Duff
2005-03-16 23:47 ` Dr. Adrian Wrigley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox