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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,da39df064d0b18d7,start X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!feeder.news-service.com!newsfeed.freenet.de!news.tu-darmstadt.de!news.belwue.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Tue, 04 Aug 2009 00:54:11 +0200 From: Georg Bauhaus Reply-To: rm.tsoh+bauhaus@maps.futureapps.de User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: GNAT's stack checking in Ubuntu 9.04 (and Shootout regex-dna) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <4a776a94$0$31878$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 04 Aug 2009 00:54:12 CEST NNTP-Posting-Host: 29ae049f.newsspool3.arcor-online.net X-Trace: DXC=JZGcg>H:N7:RadXUBHgFh3McF=Q^Z^V384Fo<]lROoR1^YC2XCjHcb9l@HmXNX?_G4A:ho7QcPOV348`8M?IHh`0Dg9l]lo2:H5 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7552 Date: 2009-08-04T00:54:12+02:00 List-Id: The GNAT that comes with Ubuntu 9.04 (GCC 4.3.3) produces storage errors where GNAT on Debian Lenny (GCC 4.3.2) and GNAT 2007 on Windows (4.3.1) don't. This happens with larger data structures. The workaround is to introduce an indirection ... (.-) Or at least I got the regex-dna test at the Shootout fixed by introducing a pointer type and an allocator, diff appended below. If we use GNAT's Spitbol Patterns for matching (from the Ada 2005 GNAT #4 version) and then the technique of the Ada 2005 GNAT #3 version for match-replace (Bj�rn Persson's variation), we will get a really, really fast regex-dna. #4 is a lot faster than #3 when matching, #3 is a lot faster when replacing matches. The diff that get's #4 going again on Ubuntu 9.04, look for type Dna_Lines_Pointer: --- regexdna.gnat 6d8829eff6a278659ecb6ebc0f03672662de39b8 +++ regexdna.gnat 09cbee8b34b6bc62a921d8bfc66e2f18cb57eeb6 @@ -120,7 +120,8 @@ begin Num_Lines := Num_Lines + 1; end if; declare - Sequence_Lines : Dna_Lines(1..Num_Lines); + type Dna_Lines_Pointer is access Dna_Lines; -- avoids stack issues + Sequence_Lines : Dna_Lines_Pointer := new Dna_Lines(1..Num_Lines); Low, Sub_Len : Natural; begin -- Distribute Sequence to Sequence_Lines @@ -149,7 +150,7 @@ begin New_Line; Put(Item => Code_Length, Width => 1); New_Line; - Put(Item => Length(Sequence_Lines), Width => 1); + Put(Item => Length(Sequence_Lines.all), Width => 1); New_Line; end;