comp.lang.ada
 help / color / mirror / Atom feed
* generic provokes segmentation fault
@ 2020-05-17 14:19 hreba
  2020-05-17 17:51 ` Dennis Lee Bieber
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: hreba @ 2020-05-17 14:19 UTC (permalink / raw)


Hi,

I'll try to describe the problem without posting loads of code. Still 
working on my thick binding of GSL/Odeiv2, the API of my package odeiv2 
consists of 3 procedures:
  - Init_Solve
  - Solve
  - Finit_solve
They basically copy values to variables which are global in odeiv, and 
pass their addresses to the C library functions of the thin binding. 
Example: Solve contains

status:= Gsl.gsl_odeiv2_driver_apply
	(solver.driver, solver.t1'Access, solver.t2,
	 solver.y(solver.y'First)'Access);

solver is a global record variable with components t1, t2 of type 
C.double, and solver.y of type

    type C_Array is array (Integer range <>) of aliased C.double;
    pragma Convention (C, C_Array);

The main program calls Init_Solve once, then Solve a hundred times, and 
finally Finit_Solve. It works and calculates the correct numbers. Now 
when I make odeiv generic:

generic
    dim:	Positive;
    type Float is digits<>;
package odeiv2 is
...

and substitute in the main program

    package Ode renames odeiv2;

with

    type Real is digits 6;
    package Ode is new odeiv2 (2, Real);

and change nothing else, I get a

raised STORAGE_ERROR : stack overflow or erroneous memory access
(SIGSEV, segmentation fault, when run under the debugger)
just at the line starting "status:= ..." shown above.
What would be an explication or a remedy for this behaviour?

-- 
Frank Hrebabetzky, Kronach	+49 / 9261 / 950 0565

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-05-18 21:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 14:19 generic provokes segmentation fault hreba
2020-05-17 17:51 ` Dennis Lee Bieber
2020-05-17 18:34 ` Dmitry A. Kazakov
2020-05-18 11:29   ` hreba
2020-05-18 12:36     ` Dmitry A. Kazakov
2020-05-18 20:16       ` hreba
2020-05-18 21:30         ` Dmitry A. Kazakov
2020-05-17 21:02 ` Jeffrey R. Carter
2020-05-18 20:21   ` hreba

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