valgrind and gmp

Torbjörn Granlund tg at gmplib.org
Tue Feb 13 14:36:26 UTC 2018


tg at gmplib.org (Torbjörn Granlund) writes:

  nisse at lysator.liu.se (Niels Möller) writes:
  
    > I'd suggest to get an official valgrind release (not a Debian improved
    > variant) and if that too is buggy, report it to Julian et al:
    
    I've now added another repro case to the bug
    https://bugs.kde.org/show_bug.cgi?id=384930
    
    I'm fairly confident that it's valgrind's handling of mul_basecase that
    is broken, do you agree?
    
  Probably so.  But couldn't it be problems with valgrind and its handling
  of mpz_set_str or functions it calls, or mpz_mul, mpn_mul, mpn_mul_n,
  etc?
  
  Perhaps it would be better to make a self-contained test case, i.e. a
  test case which does not depend on GMP?  Just some directly assigned
  unsigned long[] vectors and a call to an included mul_basecase, and then
  printf of the (poor) result?

Perhaps this:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: valgrind-nisse.c
Type: application/octet-stream
Size: 657 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-devel/attachments/20180213/c9931213/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bwl_mul_basecase.s
Type: application/octet-stream
Size: 4893 bytes
Desc: not available
URL: <https://gmplib.org/list-archives/gmp-devel/attachments/20180213/c9931213/attachment-0003.obj>
-------------- next part --------------

Run as:

bwl$ gcc valgrind-nisse.c x.s
bwl$ valgrind ./a.out 2>/dev/null
expected: ffffffffffffefff ffe0000800100000 ffff800000000dff 007ffffffff00000 001ffff800000001
     got: ffffffffffffefff 0000000000100fff ffffffffffefffff 0000000000000001 001ffff800000001

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-devel mailing list