Edmond Griffin on Mon, 20 Feb 2023 15:12:53 +0100


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

Re: Segmentation Fault in Pari/GP from gp2c-run


Hello Bill,

    Thank you very much for your speedy reply and helpful suggestion.  I replaced “warning” with “print” and was able to run my compiled code!

    Just for your information, the compiled code ran 1.4 times as fast as the regular gp.  Less than I hoped, but I think the execution time is being dominated by accessing my hard disk.

Thanks again!
Ed


> On Feb 19, 2023, at 8:58 AM, Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> wrote:
> 
> On Sun, Feb 19, 2023 at 07:57:32AM -0800, Edmond Griffin wrote:
>> Hello,
>> 
>>    I am working on an old conjecture of Erdos-Turan using Pari/GP.  Although the computations are simple, the number of them is very large.  To speed things up, I hoped to convert my .gp code into C using gp2c. I am having difficulty doing so.
>> 
>>   I believe both gp and gp2c were built successfully on my machine - a quad core i7 MacBook Pro.  When I compile and run the code using gp2c-run I get no warnings of undeclared or unused variables.  I do get the following warning before gp starts:
>> 
>> ld: warning: -undefined dynamic_lookup may not work with chained fixups
>> 
>> 
>>   Then when I call my function (extDnkc) I get
>> 
>> ? extDnkc(15,6,0,"/Volumes/BinPolyData/Diffs/")    
>>  ***   user warning: 
>>  ***   at top-level: extDnkc(15,6,0,"/Volumes/BinPolyData/Diffs/")
>>  ***                 ^---------------------------------------------
>>  *** extDnkc: bug in PARI/GP (Segmentation Fault), please report.
>> 
>> 
>> Can you suggest a course of action?
>>    fName = strjoin([fPath,strprintf("D_%d_%d_TN.csv", n, k)]);
>>    iferr(fIn=fileopen(fName,"r"), ERR, 
>>        warning(strprintf("Bad input file: %s",fName)); return,errname(ERR)=="e_FILE");
> 
> Indeed, there is a bug in PARI that cause warning() to be miscompiled by gp2c.
> I suggest to replace warning() by print() until we fix it.
> Sorry for the trouble!
> 
> Cheers,
> Bill