mpz_invert gives wrong result for > 64bit numbers under Valgrind

Jan Hartman jan.hartman at xlab.si
Tue Jul 3 14:04:50 UTC 2018


Hi,

I found a bug when running some tests under Valgrind. The mpz_invert 
function gives wrong results if its arguments are larger than 64 bits.

GMP version: 6.1.2

Valgrind version: 3.13.0

GCC: gcc version 5.5.0 20171010 (Ubuntu 5.5.0-12ubuntu1~16.04)

Kernel: Linux xlab-jan 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 
14:15:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Architecture: skylake-pc-linux-gnu

Code for reproducing: attached (Compile it with /gcc -o g gmp_valgrind.c 
-lgmp/ and run with /./g/ and /valgrind ./g/, when run normally it 
should output equal = 1 and under Valgrind equal = 0)


I know it's stated in the GMP Manual that Valgrind might not support 
instructions recently added to an ISA, but this seems like it should 
work. I hope I provided enough details to verify and reproduce this.

Best regards,

Jan


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gmp_valgrind.c
Type: text/x-csrc
Size: 468 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-bugs/attachments/20180703/61b599e8/attachment.bin>


More information about the gmp-bugs mailing list