http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688
Bug ID: 57688 Summary: -O3 -march=native generates illegal opcode on AMD Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dcb314 at hotmail dot com Created attachment 30347 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30347&action=edit C++ source code I just noticed that -march=native support broke from date 20130621 to 20130623 for AMD Phenom as follows [dcb@localhost foundBugs]$ ../results/bin/g++ -g -O3 -Wall bug113.cc [dcb@localhost foundBugs]$ ./a.out Time for caxpy1 = 0.16 seconds [5120 Mflops] [dcb@localhost foundBugs]$ ../results/bin/g++ -g -O3 -march=native -Wall bug113.cc [dcb@localhost foundBugs]$ ./a.out Illegal instruction (core dumped) [dcb@localhost foundBugs]$ Valgrind helps out with this vex amd64->IR: unhandled instruction bytes: 0x8F 0xEA 0xF8 0x10 0xD2 0x2 0x1E 0x0 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 ==23912== valgrind: Unrecognised instruction at address 0x4045e2. ==23912== at 0x4045E2: caxpy3(Vector<Complex>&, Vector<Complex>&, Complex) (bug113.cc:52) ==23912== by 0x4012C0: main (bug113.cc:258) ==23912== Your program just tried to execute an instruction that Valgrind ==23912== did not recognise. There are two possible reasons for this. ==23912== 1. Your program has a bug and erroneously jumped to a non-code ==23912== location. If you are running Memcheck and you just saw a ==23912== warning about a bad jump, it's probably your program's fault. ==23912== 2. The instruction is legitimate but Valgrind doesn't handle it, ==23912== i.e. it's Valgrind's fault. If you think this is the case or ==23912== you are not sure, please let us know and we'll try to fix it. ==23912== Either way, Valgrind will now raise a SIGILL signal which will ==23912== probably kill your program. ==23912== ==23912== Process terminating with default action of signal 4 (SIGILL) ==23912== Illegal opcode at address 0x4045E2 ==23912== at 0x4045E2: caxpy3(Vector<Complex>&, Vector<Complex>&, Complex) (bug113.cc:52) Also [dcb@localhost foundBugs]$ head /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 16 model : 4 model name : AMD Phenom(tm) II X4 970 Processor stepping : 3 microcode : 0x10000c8 cpu MHz : 3500.000 cache size : 512 KB physical id : 0