Use of malloc in mpn_lshift_com optimization 2

Dennis Schridde devurandom at
Thu Feb 15 22:01:30 UTC 2018


I noticed an issue in GMP 6.1.2 when compiling it with CFLAGS="-pipe -O2 -
march=znver1" for x86-32 on Gentoo Linux (in chroot).  Configure fails the 
"mpn_lshift_com optimization 2" test, because that test uses `malloc` where it 
should have used `calloc`, according to an investigation by FreeBSD 
developers, who created a patch that fixes the issue (which I confirm it 

This was fixed for the "gmp" repository in "Recognise AMD zen." by Torbjorn 
Granlund <tg at>:
But it was not backported to the "gmp-6.1" repository.  The other recent 
commits to that file probably also qualify for backporting.

My GCC is 6.4.0 (Gentoo 6.4.0-r1 p1.3) and the Linux kernel I am running on 
currently is from Fedora Rawhide 28 (4.15.0-0.rc4.git3.1.fc28, built 
2017-12-21 16:11:35 UTC).

Best regards,

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the gmp-bugs mailing list