Possible bug affecting mpz_popcount() in GMP 5.0.1 on Intel Core2

Emmanuel Thomé Emmanuel.Thome at gmail.com
Fri Apr 15 15:07:42 CEST 2011

On Fri, Apr 15, 2011 at 02:49:19PM +0200, Torbjorn Granlund wrote:
> Roberto Bagnara <bagnara at cs.unipr.it> writes:
>   Can someone please try to reproduce the following?
> It is difficult to find the essentials in your long text.  What is the
> claim, is it that the code performs a 16-byte aligned 16-byte load and
> that part of this load is outside of an allocated buffer?
> If that is the claim, then I'd say GMP is not too naughty; we allow
> ourself to read beyond buffer ends as long as we don't cross a possible
> page boundary.  (We don't do this from C as this is invalid, but we do
> it in assembly since there we can make this type of assumptions about
> the hardware.)

Correct bug ugly. :-)

IMO, it's possibly relatively problematic that valgrind might raise false
positives because of this. Valgrind has a `suppression list' mechanism
for such `expected oddities'. It probably would make sense to write such
a suppression list. Unfortunately I'm not sure that it is possible to say
``hey, I know this function might read off bounds, but never by more than
8 bytes off, and never across a page boundary''.



> -- 
> Torbjörn
> _______________________________________________
> gmp-discuss mailing list
> gmp-discuss at gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-discuss

More information about the gmp-discuss mailing list