Hi,

The following program crashes for me on MS Windows 7, gmp-6.1.2, when the line "gmp_randseed_ui(b, 123456);" is executed. I built gmp in the MSYS2 shell using gcc version 5.3.0 (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project).

Configure command was:

./configure CC="gcc -D__USE_MINGW_ANSI_STDIO" --enable-static --disable-shared --enable-assembly LDFLAGS=-LC:/_64/msys_530/1.0/local/lib CPPFLAGS=-IC:/_64/msys_530/1.0/local/include --prefix=C:/_64/msys_530/1.0/local

/*********************/
#include <stdio.h>
#include <gmp.h>

int main(void) {
 gmp_randstate_t a, b;
 gmp_randinit_default(a);
/* gmp_randseed_ui(a, 123456); *//* same result with or without this line */
 gmp_randinit_set(b, a);
 /* printf("%s\n", gmp_version); *//* outputs 6.1.2 */
 gmp_randseed_ui(b, 123456); /* crashes */

 return 0;
}

/********************/

AFAICT this is a gmp bug, but I don't rule out the possibility that it's a user bug.

If "a" is initialised with either gmp_randinit_lc_2exp() or gmp_randinit_lc_2exp_size() there is no crash.

Cheers,
Rob
_______________________________________________
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to