GMP 5.1.1: Valgrind reports incorrect read in __gmpn_copyd (called from __gmpz_mul_2exp)

bodrato at mail.dm.unipi.it bodrato at mail.dm.unipi.it
Wed Feb 20 21:35:36 CET 2013


Ciao Alexander,

Il Mer, 20 Febbraio 2013 2:58 pm, Alexander Kruppa ha scritto:
> The attached program triggers a valgrind error for an incorrect read.

I can not find the attached example...

> gmp-5.1.1/lib/libgmp.a && valgrind ./test_mpmod

> ==17830== Invalid read of size 8
> ==17830==    at 0x401A74: __gmpn_copyd (in

> ./config.guess
> core2-unknown-linux-gnu

> This may be related to GMP sometimes reading past the end of an array for
> efficiency (e.g., with 16-byte SSE3 data transfer instructions), as
> pointed out at http://gmplib.org/manual/Debugging.html under Debugging.

Yes, copyd, on core2, uses some sse instrunctions. You are probably
incurring in a Valgrind/GMP conflict...

> could you provide a suppression file for these cases?

I dug into the on-line documentation of Valgrind, I believe that the
option to distinguish the SSE "benign read" out of other possible
incorrect reads is: --partial-loads-ok=yes . Unfortunately I did not find
any way to enable it selectively for some functions only.

Can you please try if your test passes with "valgrind
--partial-loads-ok=yes" ? If it does, do you have any suggestion on how to
configure valgrind accordingly?

Best regards,
m

-- 
http://bodrato.it/papers/



More information about the gmp-bugs mailing list