public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD
@ 2013-06-23 16:14 dcb314 at hotmail dot com
  2013-06-23 16:48 ` [Bug c++/57688] " mikpe at it dot uu.se
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2013-06-23 16:14 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug c++/57688] -O3 -march=native generates illegal opcode on AMD
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
@ 2013-06-23 16:48 ` mikpe at it dot uu.se
  2013-06-23 17:23 ` [Bug target/57688] " paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: mikpe at it dot uu.se @ 2013-06-23 16:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

--- Comment #1 from Mikael Pettersson <mikpe at it dot uu.se> ---
Run it in gdb, wait for the fault, and disassemble the code around the faulting
PC.  That valgrind report doesn't really say anything useful.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57688] -O3 -march=native generates illegal opcode on AMD
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
  2013-06-23 16:48 ` [Bug c++/57688] " mikpe at it dot uu.se
@ 2013-06-23 17:23 ` paolo.carlini at oracle dot com
  2013-06-23 18:12 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-23 17:23 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |target

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Doesn't look like a C++ front-end issue.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57688] -O3 -march=native generates illegal opcode on AMD
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
  2013-06-23 16:48 ` [Bug c++/57688] " mikpe at it dot uu.se
  2013-06-23 17:23 ` [Bug target/57688] " paolo.carlini at oracle dot com
@ 2013-06-23 18:12 ` jakub at gcc dot gnu.org
  2013-06-23 18:41 ` dcb314 at hotmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-06-23 18:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Also, for any bugreport with -march=native or -mtune=native you need to specify
what options have been passed to cc1plus/cc1 (add -v), plus you haven't
provided preprocessed source.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57688] -O3 -march=native generates illegal opcode on AMD
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2013-06-23 18:12 ` jakub at gcc dot gnu.org
@ 2013-06-23 18:41 ` dcb314 at hotmail dot com
  2013-06-23 18:44 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2013-06-23 18:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

--- Comment #4 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Mikael Pettersson from comment #1)
> Run it in gdb, wait for the fault, and disassemble the code around the
> faulting PC.  That valgrind report doesn't really say anything useful.

   0x00000000004045d4 <+948>:    lea    -0x5(%r9),%edx
   0x00000000004045d8 <+952>:    lea    0x140(%r10),%rsi
   0x00000000004045df <+959>:    mov    %rax,%rcx
=> 0x00000000004045e2 <+962>:    bextr  $0x1e02,%rdx,%rdx
   0x00000000004045eb <+971>:    xor    %r8d,%r8d
   0x00000000004045ee <+974>:    shl    $0x6,%rdx
   0x00000000004045f2 <+978>:    lea    0x180(%r10,%rdx,1),%rdi


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57688] -O3 -march=native generates illegal opcode on AMD
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2013-06-23 18:41 ` dcb314 at hotmail dot com
@ 2013-06-23 18:44 ` pinskia at gcc dot gnu.org
  2013-06-23 18:46 ` dcb314 at hotmail dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-06-23 18:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you provide the full output of "cat /proc/cpuinfo" and not just the head?


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57688] -O3 -march=native generates illegal opcode on AMD
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2013-06-23 18:44 ` pinskia at gcc dot gnu.org
@ 2013-06-23 18:46 ` dcb314 at hotmail dot com
  2013-06-23 18:48 ` dcb314 at hotmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2013-06-23 18:46 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

--- Comment #6 from David Binderman <dcb314 at hotmail dot com> ---
Created attachment 30348
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30348&action=edit
preprocessed C++ source code


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57688] -O3 -march=native generates illegal opcode on AMD
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2013-06-23 18:46 ` dcb314 at hotmail dot com
@ 2013-06-23 18:48 ` dcb314 at hotmail dot com
  2013-06-23 18:51 ` [Bug target/57688] -O3 -march=native generates illegal opcode on AMD Phenom dcb314 at hotmail dot com
  2013-06-23 19:01 ` mikpe at it dot uu.se
  8 siblings, 0 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2013-06-23 18:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

--- Comment #7 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Andrew Pinski from comment #5)
> Can you provide the full output of "cat /proc/cpuinfo" and not just the head?

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
siblings    : 4
core id        : 0
cpu cores    : 4
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 5
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb
rdtscp
 lm 3dnowext 3dnow constant_tsc rep_good nopl nonstop_tsc extd_apicid pni
monito
r cx16 popcnt lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse
3d
nowprefetch osvw ibs skinit wdt nodeid_msr hw_pstate npt lbrv svm_lock
nrip_save
bogomips    : 7031.52
TLB size    : 1024 4K pages
clflush size    : 64
cache_alignment    : 64
address sizes    : 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57688] -O3 -march=native generates illegal opcode on AMD Phenom
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2013-06-23 18:48 ` dcb314 at hotmail dot com
@ 2013-06-23 18:51 ` dcb314 at hotmail dot com
  2013-06-23 19:01 ` mikpe at it dot uu.se
  8 siblings, 0 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2013-06-23 18:51 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

--- Comment #8 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to Jakub Jelinek from comment #3)
> Also, for any bugreport with -march=native or -mtune=native you need to
> specify what options have been passed to cc1plus/cc1 (add -v), plus you
> haven't provided preprocessed source.

 /home/dcb/gcc/results/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/cc1plus
-quiet
 -v -D_GNU_SOURCE bug113.cc -march=amdfam10 -mmmx -m3dnow -msse -msse2 -msse3
-m
no-ssse3 -msse4a -mcx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mpopcnt -mabm
-m
no-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx
-mno-avx
2 -mno-sse4.2 -mno-sse4.1 -mlzcnt -mno-rtm -mno-hle -mno-rdrnd -mno-f16c
-mno-fs
gsbase -mno-rdseed -mprfchw -mno-adx -mfxsr -mno-xsave -mno-xsaveopt --param
l1-
cache-size=64 --param l1-cache-line-size=64 --param l2-cache-size=512
-mtune=amd
fam10 -quiet -dumpbase bug113.cc -auxbase bug113 -g -O3 -version -o
/tmp/ccpBZ0u
f.s


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Bug target/57688] -O3 -march=native generates illegal opcode on AMD Phenom
  2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2013-06-23 18:51 ` [Bug target/57688] -O3 -march=native generates illegal opcode on AMD Phenom dcb314 at hotmail dot com
@ 2013-06-23 19:01 ` mikpe at it dot uu.se
  8 siblings, 0 replies; 10+ messages in thread
From: mikpe at it dot uu.se @ 2013-06-23 19:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57688

Mikael Pettersson <mikpe at it dot uu.se> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikpe at it dot uu.se

--- Comment #9 from Mikael Pettersson <mikpe at it dot uu.se> ---
Your toolchain generated an AMD XOP BEXTR insn, but your processor doesn't have
the XOP ISA extensions, so it #UDs.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2013-06-23 19:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-23 16:14 [Bug c++/57688] New: -O3 -march=native generates illegal opcode on AMD dcb314 at hotmail dot com
2013-06-23 16:48 ` [Bug c++/57688] " mikpe at it dot uu.se
2013-06-23 17:23 ` [Bug target/57688] " paolo.carlini at oracle dot com
2013-06-23 18:12 ` jakub at gcc dot gnu.org
2013-06-23 18:41 ` dcb314 at hotmail dot com
2013-06-23 18:44 ` pinskia at gcc dot gnu.org
2013-06-23 18:46 ` dcb314 at hotmail dot com
2013-06-23 18:48 ` dcb314 at hotmail dot com
2013-06-23 18:51 ` [Bug target/57688] -O3 -march=native generates illegal opcode on AMD Phenom dcb314 at hotmail dot com
2013-06-23 19:01 ` mikpe at it dot uu.se

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).