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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!postnews.google.com!l41g2000cwc.googlegroups.com!not-for-mail From: "braver" Newsgroups: comp.lang.ada Subject: Re: Memory limits in Ada where Fortran has none Date: 6 Mar 2005 21:55:59 -0800 Organization: http://groups.google.com Message-ID: <1110174959.536952.153940@l41g2000cwc.googlegroups.com> References: <1110070479.250902.220540@l41g2000cwc.googlegroups.com> <1110089930.914615.182480@l41g2000cwc.googlegroups.com> <1260026.XKFy62IHbW@linux1.krischik.com> <1110125661.857477.251640@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: 68.38.224.153 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1110174963 23345 127.0.0.1 (7 Mar 2005 05:56:03 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 7 Mar 2005 05:56:03 +0000 (UTC) In-Reply-To: User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: l41g2000cwc.googlegroups.com; posting-host=68.38.224.153; posting-account=747fcg0AAAAk37ynL4bMm6Gl7Dz_tnyx Xref: g2news1.google.com comp.lang.ada:8794 Date: 2005-03-06T21:55:59-08:00 List-Id: 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