comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: Stumped: Seg Fault with System.Secondary_Stack.SS_Mark()
Date: Thu, 06 Sep 2012 23:18:50 +0200
Date: 2012-09-06T23:18:50+02:00	[thread overview]
Message-ID: <87bohi26kl.fsf@ludovic-brenta.org> (raw)
In-Reply-To: 016ff78a-64f9-4a42-a079-e544526e2f8a@googlegroups.com

awdorrin <awdorrin@gmail.com> 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.



  reply	other threads:[~2012-09-14 17:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06 19:34 Stumped: Seg Fault with System.Secondary_Stack.SS_Mark() awdorrin
2012-09-06 19:57 ` Ludovic Brenta
2012-09-06 20:53   ` awdorrin
2012-09-06 21:18     ` Ludovic Brenta [this message]
2012-09-06 22:13       ` awdorrin
2012-09-07 14:38         ` awdorrin
2012-09-07 14:55           ` Ludovic Brenta
2012-09-07 15:35           ` Simon Wright
2012-09-07 16:18             ` awdorrin
2012-09-07 16:31               ` awdorrin
2012-09-07 17:07                 ` Simon Wright
2012-09-07 17:50                   ` awdorrin
2012-09-08 13:23                     ` francois_fabien
2012-09-10 13:50                       ` awdorrin
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox