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

            Bug ID: 428004
           Summary: Illegal opcode in NTL C++ library
           Product: valgrind
           Version: 3.13.0
          Platform: Ubuntu Packages
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: callgrind
          Assignee: josef.weidendor...@gmx.de
          Reporter: shaveer.bajp...@mail.utoronto.ca
  Target Milestone: ---

SUMMARY
Hi, I encountered this error trace when trying to run a program using the NTL
C++ library from https://shoup.net/ntl/.


vex amd64->IR: unhandled instruction bytes: 0x62 0xF1 0x75 0x48 0xEF 0xC9 0xC5
0xF9 0x2E 0xC1
vex amd64->IR:   REX=0 REX.W=0 REX.R=0 REX.X=0 REX.B=0
vex amd64->IR:   VEX=0 VEX.L=0 VEX.nVVVV=0x0 ESC=NONE
vex amd64->IR:   PFX.66=0 PFX.F2=0 PFX.F3=0
==11959== valgrind: Unrecognised instruction at address 0x177dab.
==11959==    at 0x177DAB: _ntl_IsFinite(double*) (ctools.cpp:130)
==11959==    by 0x144EDA: NTL::conv(NTL::RR&, double) (tools.h:404)
==11959==    by 0x14A4DE: NTL::ReallyComputePi(NTL::RR&) (RR.h:420)
==11959==    by 0x14A983: NTL::ComputePi(NTL::RR&) (RR.cpp:1666)
==11959==    by 0x10EDBB: _GLOBAL__sub_I_main (in
/home/ubuntu/environment/HEAAN/HEAAN/run/TestHEAAN)
==11959==    by 0x177E7C: __libc_csu_init (in
/home/ubuntu/environment/HEAAN/HEAAN/run/TestHEAAN)
==11959==    by 0x5A2CB27: (below main) (libc-start.c:266)
==11959== Your program just tried to execute an instruction that Valgrind
==11959== did not recognise.  There are two possible reasons for this.
==11959== 1. Your program has a bug and erroneously jumped to a non-code
==11959==    location.  If you are running Memcheck and you just saw a
==11959==    warning about a bad jump, it's probably your program's fault.
==11959== 2. The instruction is legitimate but Valgrind doesn't handle it,
==11959==    i.e. it's Valgrind's fault.  If you think this is the case or
==11959==    you are not sure, please let us know and we'll try to fix it.
==11959== Either way, Valgrind will now raise a SIGILL signal which will
==11959== probably kill your program.
==11959== 
==11959== Process terminating with default action of signal 4 (SIGILL)
==11959==  Illegal opcode at address 0x177DAB
==11959==    at 0x177DAB: _ntl_IsFinite(double*) (ctools.cpp:130)
==11959==    by 0x144EDA: NTL::conv(NTL::RR&, double) (tools.h:404)
==11959==    by 0x14A4DE: NTL::ReallyComputePi(NTL::RR&) (RR.h:420)
==11959==    by 0x14A983: NTL::ComputePi(NTL::RR&) (RR.cpp:1666)

The line identified in ctools.cpp at 130 is the return line of this function:

long _ntl_IsFinite(double *p)
{
   volatile double x = *p;
   *p = x;

   double y = x;
   double diff = y - x;
   return diff == 0.0;
}

I understand the function signature defines the return as type long when the
return expression will return a boolean, but won't this translate to a 0 or 1?
I am not sure why this crashes valgrind.


Using Ubuntu 18.04.5 LTS

Thanks for your help!

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

Reply via email to