Using a pre-computed array in another function?

Alasdair McAndrew amca01 at
Sun Jul 8 15:49:14 CEST 2012

I've initialized every variable, but still the error.  I don't think it's
the program logic - I've run very similar programs without GMP with no
troubles.   When I run the program through gdb I obtain the error:

Program received signal SIGSEGV, Segmentation fault.
0xb7f8ee5a in __gmpz_set_str () from /usr/local/lib/

The problem occurs when the variable A is accessed in the mpz_myfun


On Sun, Jul 8, 2012 at 9:25 PM, Torbjorn Granlund <tg at> wrote:

> Alasdair McAndrew <amca01 at> writes:
>   Thanks for that, but I don't think that's the cause of it: I tested a
> loop
>   to print some of the A[i] values and they're all there.  It's just that
> for
>   some reason, the A[i] values are "invisible" to my mpz_myfun function.
> Certainly, mpz_t variables need to be initialised, whether scalar or in
> an array.
> If your program malfunctions even with all variables properly
> initialised, then your program has more bugs.  Then try to debug your
> program using standard debugging techniques.
> --
> Torbjörn


More information about the gmp-discuss mailing list