Invalid read in mpz_powm_ui

Marc Glisse marc.glisse at inria.fr
Fri Dec 7 09:33:59 CET 2012


On Thu, 6 Dec 2012, Sylvain Pion wrote:

> 2012/12/6 Emmanuel Thomé <emmanuel.thome at gmail.com>:
>> My experience is that the valgrind developers are doing a very good
>> job at supporting a fair share of the instructions which show up, but
>> they can't always be exhaustive. If we, as users of gmp for instance,
>> are impacted by some missing instructions, a nice thing to do is to
>> provide the fix by ourselves. Especially if a single instruction is
>> concerned (for a whole range of instruction encodings, it's a
>> different issue). For example, I recall having helped in to get rclq
>> supported on amd64, long ago. That was specifically for using gmp
>> (Pierrick's asm patches, by then). Same for pclmulqdq, more recently
>> (not gmp-related).
>
> I have also faced the same problem with FPU rounding mode changes
> instructions, as typically used by interval arithmetic.

But then most compilers can't even produce valid code for that, except at 
-O0. Valgrind has some code to handle rounding modes, but last time I 
looked it was disabled to avoid slowing everything down.

> In case you are not aware, I think the good news here is that
> compilers (GCC and LLVM) are adding an equivalent feature named
> AddressSanitizer.

>From what I've seen, they don't advertise it as a full valgrind 
replacement but as a cheaper alternative that detects a range of problems 
with some overlap with those valgrind can find. There was already mudflap 
in that category (will be removed in gcc-4.9, replaced by asan). Running 
valgrind will still be a good idea when you can afford it.

(OT, sorry)

-- 
Marc Glisse


More information about the gmp-bugs mailing list