Using a pre-computed array in another function?
Alasdair McAndrew
amca01 at gmail.com
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/libgmp.so.10
The problem occurs when the variable A is accessed in the mpz_myfun
function.
Thanks,
Alasdair
On Sun, Jul 8, 2012 at 9:25 PM, Torbjorn Granlund <tg at gmplib.org> wrote:
> Alasdair McAndrew <amca01 at gmail.com> 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.
>
> www.cs.mtu.edu/~soner/Classes/CS-3411/Slides/05-Debug.pdf
>
> --
> Torbjörn
>
--
Blog: http://amca01.wordpress.com
Web: http://sites.google.com/site/amca01/
Facebook: http://www.facebook.com/alasdair.mcandrew
More information about the gmp-discuss
mailing list