https://bugs.kde.org/show_bug.cgi?id=384930

            Bug ID: 384930
           Summary: Valgrind fails to compute correctly some code using
                    the GMP library
           Product: valgrind
           Version: 3.13.0
          Platform: Debian testing
                OS: Linux
            Status: UNCONFIRMED
          Severity: major
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: m...@cyrilbouvier.fr
  Target Milestone: ---

Created attachment 107934
  --> https://bugs.kde.org/attachment.cgi?id=107934&action=edit
bug.c

When I run the simple program obtained from the source file bug.c in
attachment, I obtain different results depending on whether it is run under
valgrind or not.

When it is not run under valgrind, I obtain the expected values (lcm (2^i,
42)), when it is run under valgrind, the values obtained are false for large i.

I suspect that for large value of i, 2^i exceed a threshold in the GMP library
code and that some asm code is used. It may be that the asm code in not
correctly emulate by valgrind.


How to reproduce the code:

GMP version: 6.1.2 (configured and compiled with gmp-mparam.h ->
mpn/x86_64/skylake/gmp-mparam.h)

$ gcc -o bug bug.c -lgmp -lm
$ ./bug > normal
$ valgrind ./bug > valgrind 
$ cmp normal valgrind 
normal valgrind differ: byte 339003, line 1469

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to