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.74.201 with SMTP id w9mr1141544pbv.0.1325758965588; Thu, 05 Jan 2012 02:22:45 -0800 (PST) Path: lh20ni133003pbb.0!nntp.google.com!news2.google.com!goblin3!goblin.stu.neva.ru!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Thu, 05 Jan 2012 11:19:39 +0100 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.7; en-US; rv:1.9.2.25) Gecko/20111213 Thunderbird/3.1.17 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Can't set executable stack size during compilation References: <4f047e0f$0$6582$9b4e6d93@newsspool3.arcor-online.net> <4f04c66c$0$6625$9b4e6d93@newsspool2.arcor-online.net> In-Reply-To: Message-ID: <4f057934$0$7623$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 05 Jan 2012 11:19:32 CET NNTP-Posting-Host: eca15726.newsspool1.arcor-online.net X-Trace: DXC=16YGZC_hXG<^8FBo0_81f>ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg2TT2:ZAgWN21PCY\c7>ejV8>nKe26<7?U8FlRQ7GCJ?Z4 X-Complaints-To: usenet-abuse@arcor.de Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2012-01-05T11:19:32+01:00 List-Id: On 1/5/12 5:35 AM, Bill Findlay wrote: > As it happens, when I ran it I got: > >> /Users/wf/KDF9/emulation/Build: ./onstack >> >> raised CONSTRAINT_ERROR : onstack.adb:19 range check failed > > because my default GNAT switches ask it to (attempt to) check for uses of > uninitialized variables. A possible solution of GNAT's stack size issue, an Ada solutions of sorts, appears to be available with tasking. Move the computation to a task and add pragma Storage_Size (Minimum_Storage_Size); in the task's declaration, thus procedure Run_in_Task 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 := (others => (others => Num'First)); end record; Minimum_Storage_Size : constant := 11_000_000; -- task's storage size; addressing stack size issues with GNAT -- about equal to 512 * 512 * 2 * 5 * 4 task Onstack is pragma Storage_Size (Minimum_Storage_Size); end Onstack; task body Onstack is separate; begin null; end Run_in_Task; separate (Run_in_Task) task body OnStack is 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); pragma Inspection_Point (Data); end OnStack;