Invalid read in mpz_powm_ui

Marc Glisse marc.glisse at
Thu Dec 6 15:57:22 CET 2012

On Thu, 6 Dec 2012, Torbjorn Granlund wrote:

> Zimmermann Paul <Paul.Zimmermann at> writes:
>  >   PS: aren't the nightly builds of GMP tested against valgrind?
>  >
>  > Nope.  Perhaps we should.  I ran it now, I and found 4 errors (including
>  > yours).  Two of these have not yet been analysed, but one of these
>  > unanalysed problems is related to code not yet used by any documented
>  > interface.  The 4th error was harmless and due to how we do mpn_incr_u.
>  > I implemented a simple workaround to silence valgrind.
>  I fully agree you should!
> I gave it a shot, but neither on a AMD FX nor on an ARM v7 does it
> complete GMP tests in a default build.  It hits unsupported instructions
> like vmovsd (for AMD64) and umaal (for ARM).

On a non-VEX amd64, all tests (default build with --enable-cxx) pass 
inside valgrind. VEX-encoded instructions do seem to be new in 
valgrind-3.8. -mno-sse2avx might help until then, or a -march for a 
slightly older cpu.

> I'll wait for valgrind 3.8 to arrive to FreeBSD's ports or GNU/Linux's
> various package systems.

3.8.1 is in debian unstable, for instance.

Marc Glisse

More information about the gmp-bugs mailing list