comp.lang.ada
 help / color / mirror / Atom feed
From: reinert <reinkor@gmail.com>
Subject: Re: Help needed - "Storage_Error stack overflow or erroneous memory access"
Date: Sun, 18 Jun 2017 21:53:27 -0700 (PDT)
Date: 2017-06-18T21:53:27-07:00	[thread overview]
Message-ID: <d02780f5-a4f5-4681-a08a-4fc04fda7b67@googlegroups.com> (raw)
In-Reply-To: <1f3089a8-a304-4be3-ab1d-bff5c5b75a18@googlegroups.com>

OK, for those having interest:

I have somehow sorted out the problem. 
The lesson learned is that I may have done something wrong when using "with invariant .." and the compiler error message could be more helpful for programmers like me :-) 

Here is a test program illustrating. It compiles without error on my debian 8.8 (jessie) machine, but the debian 9 (stretch) gives a cryptic error message.
Could anybody confirm? And maybe elaborate?

with frame1;         use frame1;
procedure c0 is
   df : df_t;
begin
   df.center0 (True);
end c0;

-- package:

with Ada.Numerics.Generic_Real_Arrays;

package frame1 is

   subtype real is float;

   package gra is new Ada.Numerics.Generic_Real_Arrays (real);
   use gra;

   type frame_t is tagged private;

   procedure center0 (frame : in out frame_t; b : Boolean);

   type df_t is new frame_t with private;

private

   type frame_t is tagged record
      a, b                           : Boolean := False;
      r_a, r_b                       : real_vector(1..2);
      set_modus                      : Boolean := False;
      dynamic_frame1, dynamic_frame2 : real_vector (1 .. 2);
      center0                        : Boolean := False;
      active1                        : Boolean := False;
      w1,w2                          : real_vector(1..2);
   end record with
       type_invariant =>
             ((if
               frame_t.set_modus
         then
           frame_t.dynamic_frame1 (1) <= frame_t.dynamic_frame2 (1) and
           frame_t.dynamic_frame1 (2) >= frame_t.dynamic_frame2 (2)));

   type df_t is new frame_t with record
      focus1 : Boolean              := False;
   end record;

end frame1;

package body frame1 is

   procedure center0 (frame : in out frame_t; b : Boolean) is
   begin
      frame.center0 := b;
   end center0;

end frame1;




~        

  reply	other threads:[~2017-06-19  4:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-18 10:34 Help needed - "Storage_Error stack overflow or erroneous memory access" reinert
2017-06-18 10:41 ` Simon Clubley
2017-06-18 12:00   ` reinert
2017-06-18 12:24     ` Egil H H
2017-06-18 14:58       ` Simon Clubley
2017-06-18 15:44         ` reinert
2017-06-18 18:04           ` reinert
2017-06-19  4:53             ` reinert [this message]
2017-06-19  7:03               ` Simon Wright
2017-06-19 13:01               ` Simon Clubley
2017-06-19 14:58                 ` reinert
2017-06-19 17:33                   ` Simon Clubley
2017-06-18 11:59 ` Dmitry A. Kazakov
replies disabled

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