Bill Allombert on Fri, 10 Jul 2015 13:52:02 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: gp2c segfault


On Fri, Jul 10, 2015 at 10:21:27AM +0200, Jeroen Demeyer wrote:
> There is another issue: the GP code
> 
> global(x);
> global(x);

This is not supported.

> generates C code containing
> 
> static void x;
> static GEN x;
> 
> which is obviously not correct.
> 
> I know that one normally doesn't declare the same global twice, but
> it can occur when concatenating several GP scripts, each declaring
> the same variable global.

The same variable, or two variables with the same name ?
Neither cases are supported.

You cannot expect to get good results with GP2C if you use global
variables, unless you are very careful to treat them as read only
after initialization and use clone().
This is a fundamental limitation of the memory model and of the
GP / C interface.

So I would suggest you start by cleaning your code.

Cheers,
Bill.