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

Alexander Kruppa akruppa at
Thu Feb 21 18:39:14 CET 2013

2013/2/21 Torbjorn Granlund <tg at>:

> We should make sure this is really a valid 16-bit aligned read before we
> report any valgrind bug.
> --
> Torbjörn

0x0000000000401a74 in __gmpn_copyd ()
(gdb) disas 0x401a6f,0x401a7d
Dump of assembler code from 0x401a6f to 0x401a7d:
   0x0000000000401a6f <__gmpn_copyd+175>:	retq
   0x0000000000401a70 <__gmpn_copyd+176>:	sub    $0x10,%rdx
=> 0x0000000000401a74 <__gmpn_copyd+180>:	movaps (%rsi),%xmm0
   0x0000000000401a77 <__gmpn_copyd+183>:	jb     0x401afe <__gmpn_copyd+318>
End of assembler dump.
(gdb) info reg
rax            0x51f45f0	85935600
rbx            0xf6	246
rcx            0x0	0
rdx            0x6b	107
rsi            0x51f45a0	85935520
rdi            0x51f4d98	85937560
rbp            0x7b	0x7b
rsp            0x7ff000448	0x7ff000448
r8             0x6be7d2eeb1	463450861233
r9             0x3d	61
r10            0x7feffee10	34342956560
r11            0x4eb7580	82539904
r12            0x51f45f0	85935600
r13            0x7ff0004b0	34342962352
r14            0x7ff0004c0	34342962368
r15            0x7b	123
rip            0x401a74	0x401a74 <__gmpn_copyd+180>
eflags         0x202	[ IF ]
cs             0x33	51
ss             0x2b	43
ds             0x0	0
es             0x0	0
fs             0x0	0
gs             0x0	0

%rsi is divisible by 16, so looks properly aligned.


More information about the gmp-bugs mailing list