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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b2a8d8078565e510 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Error in gnat-4.6 (opensuse 11.4) ? Date: Thu, 17 Mar 2011 14:34:29 +0000 Organization: A noiseless patient Spider Message-ID: References: <18becfb4-48a3-4e36-a078-48cfa444108b@x1g2000yqb.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="dFCm8HWntFqmDIilBLqEJQ"; logging-data="12706"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+ApTsF7BfWLrg+nU0/in8U3RYBfRXxjCw=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin) Cancel-Lock: sha1:noiO0m6/uxsC6W9b2Oi8eQUbyUM= sha1:4CPOC4djw3NtKEyIPV3VB0FiRg0= Xref: g2news2.google.com comp.lang.ada:19254 Date: 2011-03-17T14:34:29+00:00 List-Id: reinkor writes: > raised STORAGE_ERROR : stack overflow (or erroneous memory access) > > If I change: "type Real is Digits 16;" -> "type Real is Digits > 15;" > then I do not get "stack overflow". Similarly, if I comment out for > example the statement " fe,xe : fe_t;" > type Real is Digits 16; This (on Intel hardware) asks for what GNAT calls Long_Long_Float, which requires 10 bytes. "digits 15" asks for Long_Float, which requires 8 bytes. > type f_t is array(1..0400) of Real; > type fe_t is array(1..1000) of Real; > > type Node_t is > record > f, fm : f_t; > fe,xe : fe_t; > x : Real; > end record; > > Node : array (1..200) of Node_t; Node is declared on the stack, and uses 200*(400+400+1000+1000+1) = 560_000 Reals, which for Long_Float uses under 5MB of stack, for Long_Long_Float uses just over and is probably the cause of your reported stack_overflow. You might be able to improve matters by using the ulimit command; it didn't work here (Mac OS X). The only real way is to use heap allocation: type Node_Array is array (Positive range <>) of Node_t; type Node_Array_P is access Node_Array; Node : Node_Array_P := new Node_Array (1..200);