Bug 307612

Summary: SIGILL while profiling a program compiled using g++ 4.6.3 and march=native flag on Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
Product: [Developer tools] valgrind Reporter: Jiri <george.erokhin>
Component: vexAssignee: Julian Seward <jseward>
Status: RESOLVED DUPLICATE    
Severity: minor CC: tom
Priority: NOR    
Version: 3.7.0   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Jiri 2012-09-30 11:30:39 UTC
vex amd64->IR: unhandled instruction bytes: 0xC5 0xFB 0x10 0x0 0xC5 0xFB 0x10 0x4D
==8008== valgrind: Unrecognised instruction at address 0x4004e0.
...
==8008== Process terminating with default action of signal 4 (SIGILL)
==8008==  Illegal opcode at address 0x4004E0



Reproducible: Always

Steps to Reproduce:
1. make test.cc file with the following content:
int main() {
    double x = 1.;
    double* a = &x;
    double m = 1.;
    m *= (*a);
    return 0;
}
2. execute the following console command g++ -march=native test.cc -o a && valgrind --tool=memcheck ./a
3.
Actual Results:  
==8008== Memcheck, a memory error detector
==8008== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==8008== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info
==8008== Command: ./a
==8008== 
vex amd64->IR: unhandled instruction bytes: 0xC5 0xFB 0x10 0x0 0xC5 0xFB 0x10 0x4D
==8008== valgrind: Unrecognised instruction at address 0x4004e0.
==8008==    at 0x4004E0: main (in /home/george/Desktop/a)
==8008== Your program just tried to execute an instruction that Valgrind
==8008== did not recognise.  There are two possible reasons for this.
==8008== 1. Your program has a bug and erroneously jumped to a non-code
==8008==    location.  If you are running Memcheck and you just saw a
==8008==    warning about a bad jump, it's probably your program's fault.
==8008== 2. The instruction is legitimate but Valgrind doesn't handle it,
==8008==    i.e. it's Valgrind's fault.  If you think this is the case or
==8008==    you are not sure, please let us know and we'll try to fix it.
==8008== Either way, Valgrind will now raise a SIGILL signal which will
==8008== probably kill your program.
==8008== 
==8008== Process terminating with default action of signal 4 (SIGILL)
==8008==  Illegal opcode at address 0x4004E0
==8008==    at 0x4004E0: main (in /home/george/Desktop/a)
==8008== 
==8008== HEAP SUMMARY:
==8008==     in use at exit: 0 bytes in 0 blocks
==8008==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
==8008== 
==8008== All heap blocks were freed -- no leaks are possible
==8008== 
==8008== For counts of detected and suppressed errors, rerun with: -v
==8008== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
Illegal instruction


Expected Results:  
nothing (no errors)

configuration:
Linux Mint 13 Maya,
kernel: Linux version 3.2.0-23-generic
g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
processor: Intel(R) Core(TM) i7-2670QM CPU @ 2.20GHz
Comment 1 Julian Seward 2012-09-30 11:42:58 UTC
Upgrade to 3.8.1.  This is an AVX instruction that is supported only
in Valgrind 3.8.0 and later.
Comment 2 Tom Hughes 2012-09-30 11:59:56 UTC

*** This bug has been marked as a duplicate of bug 273475 ***