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: a07f3367d7,4590cbe206fc9bb9 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.180.82.166 with SMTP id j6mr828496wiy.1.1347644443918; Fri, 14 Sep 2012 10:40:43 -0700 (PDT) Path: q11ni64815116wiw.1!nntp.google.com!feeder3.cambriumusenet.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.138.MISMATCH!xlned.com!feeder5.xlned.com!feed.xsnews.nl!border-2.ams.xsnews.nl!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!news.panservice.it!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: Stumped: Seg Fault with System.Secondary_Stack.SS_Mark() Date: Thu, 06 Sep 2012 23:18:50 +0200 Organization: A noiseless patient Spider Message-ID: <87bohi26kl.fsf@ludovic-brenta.org> References: <6dfcb108-01de-42e4-962a-87a9ac91741c@googlegroups.com> <87fw6u2abw.fsf@ludovic-brenta.org> <016ff78a-64f9-4a42-a079-e544526e2f8a@googlegroups.com> Mime-Version: 1.0 Injection-Info: mx04.eternal-september.org; posting-host="65e08b74fafb1ef4177cdd6e192edbdf"; logging-data="13571"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX185tv674OqIPzbpQUVssady" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:E64OaojW7LY3VeQi5McClhce4Fg= sha1:VUIAWXR2QdJO6oBGAoq2hA+OFKw= Content-Type: text/plain; charset=us-ascii Date: 2012-09-06T23:18:50+02:00 List-Id: awdorrin writes: > The -gnatDG results, for the function in question: > > function r_de__get_de_int (de_num : in r_de__de_num_type; to_unit : > in r_convert.r_convert__unit_type := r_convert.r_convert__none) > return global_types__int32 is > M875b : system__secondary_stack__mark_id := > $system__secondary_stack__ss_mark; > > procedure r_de__get_de_int___clean is > begin > $system__secondary_stack__ss_release (M875b); > return; > end r_de__get_de_int___clean; > begin > de_val_flt : global_types__float64; > rc : global_types__int32; > [constraint_error when > r_de__de_data = null > "access check failed"] > [constraint_error when > not (r_de__Tde_num_typeB(de_num) in 1 .. r_de__de_data.all'last) > "index check failed"] > r_de__get_de (de_num, r_de__de_data.all (de_num).addr, to_unit, > de_val_flt, rc); > if rc /= 0 then > subtype r_de__get_de_int__TS863bS is string (1 .. 11); > S863b : string (1 .. 11); > P864b : natural; > $system__img_int__image_integer (integer(rc), S863b, P864b); > R865b : constant natural := P864b; > B869b : declare > begin > g_error.g_error__add_to_q ($system__string_ops__str_concat > ("R_DE.GET_DE_INT: FAILED. RC = ", S863b (1 .. R865b)), > error_type => g_common.g_common__non_severe); > end B869b; > if rc = -1 then > $__gnat_raise_exception (ada__exceptions__exception_id!( > r_de__illegal_conversion'reference), "rde_b.ada:2305"); > elsif rc = -2 then > $__gnat_raise_exception (ada__exceptions__exception_id!( > r_de__get_de_exception'reference), "rde_b.ada:2308"); > end if; > end if; > [constraint_error when > not (de_val_flt > (-(4503599628419072.0*2**(-21))) and then > de_val_flt < (9007199252643840.0*2**(-22))) > "overflow check failed"] > return global_types__int32(de_val_flt); > at end > r_de__get_de_int___clean; > end r_de__get_de_int; > > > I'm still not sure what to make of that... It appears that the secondary stack is made necessary by this part: > begin > g_error.g_error__add_to_q ($system__string_ops__str_concat > ("R_DE.GET_DE_INT: FAILED. RC = ", S863b (1 .. R865b)), > error_type => g_common.g_common__non_severe); > end B869b; The call to the string concatenation operator "&" returns a string of unconstrained type on the secondary stack (even though both operands have a fixed size known at compile time). I suggest you comment out this error reporting and see whether this eliminates the secondary stack and, more importantly, the run-time error it causes. If that works, maybe you can reintroduce the error reporting without using "&", e.g. by using Unbounded_String.Append or simply fixed-length string slices instead. Also I suggest you investigate why you're getting errors when executing $system__secondary_stack__ss_mark; are you running on a bare-board system that does not support the secondary stack? Or running out of memory? HTH -- Ludovic Brenta.