Ruhma Tahir on Mon, 03 Dec 2012 23:43:32 +0100

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

Re: bug in PARI/GP (Segmentation Fault)

Thanks for the quick reply Bill :)

Yes, of course added the main function otherwise it wont run. But only the main function is mine, rest all is the output of gp2c.

It compiles fine with me too, its only when I run it that I get the segmentation fault error. I compiled it with the command generated by the gp2c program in the C file, i.e.,

-c -o -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -fPIC -I"/usr/local/include" && /usr/bin/gcc -o -shared -O3 -Wall -fno-strict-aliasing -fomit-frame-pointer -fPIC -Wl,-shared -lc -lm -L/usr/local/lib -lpari

How are you compiling it? I am new with C and have never used a debugger :( ..... thanks for looking into it btw, much appreciated.

On 3 December 2012 21:23, Bill Allombert <> wrote:
On Mon, Dec 03, 2012 at 08:59:54PM +0000, Ruhma Tahir wrote:
> Hi,
> I get the following error at run time when i run my C code which uses pari
> library:-

> The C code returned by gp2c is following:-
> int main(void)
> {
> printf("Hello\n");
> pari_init(1000000,2);
> GEN A;
>  func(A);
> pari_close();
> return 0;
> }

Well you added the main() function, didn't you ?

I compiled your C program and it works fine.
$ ./hnf
[9, -36, 30; -36, 192, -180; 30, -180, 180]
[6, 0, 3; 0, 12, 0; 0, 0, 30]

How did you compile your program ?
Maybe run it under the debugger (gdb).


Ruhma Tahir