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.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bf2571446148ae30 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.190.2 with SMTP id gm2mr38538284pbc.4.1325694612838; Wed, 04 Jan 2012 08:30:12 -0800 (PST) Path: lh20ni125498pbb.0!nntp.google.com!news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 04 Jan 2012 17:27:59 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Can't set executable stack size during compilation References: In-Reply-To: Message-ID: <4f047e0f$0$6582$9b4e6d93@newsspool3.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 04 Jan 2012 17:27:59 CET NNTP-Posting-Host: 49f52a9f.newsspool3.arcor-online.net X-Trace: DXC=jf;Oack_g=n<6cDJZfMd_cMcF=Q^Z^V3h4Fo<]lROoRa8kFjLh>_cHTX3jmVMkb302iC_h X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Date: 2012-01-04T17:27:59+01:00 List-Id: On 04.01.12 16:49, Erich wrote: > I have a problem setting the stack size of a GNAT made program during > compilation. It is a bit memory extensive and sometimes yields a > storage error with the standard stack size (I'd prefer to avoid the > heap for the time being). > > None of the methods described here: > > http://gcc.gnu.org/onlinedocs/gnat_ugn_unw/Setting-Stack-Size-from-gnatlink.html > > so far had any effect on the executable. (The -Xlinker version yields > a linker error when set as link option in GNAT-GPS.) Using ulimit -s > 32768 manually in the shell solves the problem, but this is not a good > option for final deployment. This looked like having relevant information. The last paragraph hints at setrlimit(2). http://linux.derkeiler.com/Newsgroups/comp.os.linux.development.apps/2008-12/msg00068.html FWIW, I made a little test program; I think it is legal but it crashes consistently when translated with GNAT/GCC. With -fstack-check given, the most unexpected thing to see is a segmentation fault! procedure OnStack is type Num is range 1 .. 10000; type Index is range 1 .. 512; type Table is array (Index, Index) of Num; type Big is record X1, X2, X3, X4, X5: Table; end record; function Add (A, B : Big) return Big is Result : Big; function Add_Component (Left, Right: Table) return Table is Result : Table; begin for M in Left'Range loop for N in Right'Range loop Result (M, N) := Left(M, N) + Right(M, N); end loop; end loop; return Result; end Add_Component; begin Result.X1 := Add_Component (A.X1, B.X1); Result.X2 := Add_Component (A.X2, B.X2); Result.X3 := Add_Component (A.X3, B.X3); Result.X4 := Add_Component (A.X4, B.X4); Result.X5 := Add_Component (A.X5, B.X5); return Result; end Add; X, Y: Big; Data : Big; begin Data := Add (X, Y); end OnStack;