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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: hreba Newsgroups: comp.lang.ada Subject: generic provokes segmentation fault Date: Sun, 17 May 2020 16:19:05 +0200 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net uaFgA8Skv8lVi6jipYyR8wZOmPUFFTD842ifH4B30ZzFV2CJay Cancel-Lock: sha1:H80vpLnn9mRicPzIpH/v714A5uo= X-Mozilla-News-Host: news://News.Individual.DE:119 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58710 Date: 2020-05-17T16:19:05+02:00 List-Id: 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