From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26570 invoked by alias); 4 Jul 2011 20:48:56 -0000 Received: (qmail 26562 invoked by uid 22791); 4 Jul 2011 20:48:56 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_AV,TW_CL,TW_FX,TW_LQ,TW_QD,TW_VM,TW_VN,TW_XS,TW_XT X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 04 Jul 2011 20:48:42 +0000 From: "nemykal at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/49633] New: GCC -march=native on Intel Sandy Bridge causes some 'invalid opcode' X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nemykal at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 04 Jul 2011 20:48:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00261.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49633 Summary: GCC -march=native on Intel Sandy Bridge causes some 'invalid opcode' Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: nemykal@gmail.com Hi, Just noticed this on my gentoo system after compiling gawk. Checked dmesg and saw these errors: gawk[12982] general protection ip:400264 sp:7fffb95d8278 error:0 in gawk[400000+16d000] gawk[435] trap invalid opcode ip:442f27 sp:7fffeea30d10 error:0 in gawk[400000+63000] Using gcc version 4.7.0-alpha20110625 20110625 Seems pretty simple to me: the compiler adds -mfused-madd when it shouldn't be. When I compiled gawk with -march=native, it caused the above errors. As soon as I changed the CFLAGS to "-march=native -mno-fused-madd -O2 -pipe", gawk worked properly. I'm getting these errors on my system which has an Intel 2600k (sandy bridge) I dont believe these have the fused multiply add instructions yet! Here are the flags in /proc/cpuinfo: flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 popcnt aes xsave avx lahf_lm ida arat epb xsaveopt pln pts dts tpr_shadow vnmi flexpriority ept vpid