When building libcpp/lex.c for -march=i586 and -mtune=generic on i586-linux-gnu generic code contains cmov* instructions which will SIGILL on finger@mtech:~> cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 5 model : 8 model name : AMD-K6(tm) 3D processor stepping : 12 microcode : 0x8b cpu MHz : 428.811 cache size : 64 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr cx8 pge mmx syscall 3dnow k6_mtrr up bogomips : 857.62 clflush size : 32 cache_alignment : 32 address sizes : 32 bits physical, 32 bits virtual power management: CPUs which are perfectly fine matching -march=i586. When you remove all target attribute annotated code from lex.c these instructions disappear. Thus, a compiler built for i586 does not work. The bug persists with GCC 4.6, 4.7 and 4.8.
Created attachment 27304 [details] preprocessed source Preprocessed lex.c from the 4.6 branch.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49104 ?
The revision that supposedly fixed the issue is in reporters sources (for reference: https://bugzilla.novell.com/show_bug.cgi?id=760210). Note that I see cmov* instructions in _cpp_clean_line, _cpp_temp_token, cpp_avoid_paste, cpp_output_line_to_string and more. _Not_ only in the SSE marked functions.
Created attachment 27305 [details] Proposed patch Untested patch that changes TARGET_CMOVE test.
I can confirm the patch works though I don't trivially see how it fixes the interaction with the option save/restore code ;)
(In reply to comment #5) > I can confirm the patch works though I don't trivially see how it fixes the > interaction with the option save/restore code ;) It doesn't "fix" anything in option processing code, the patch avoids changing ix86_arch_features behind option processing back.
Author: uros Date: Fri May 4 16:42:23 2012 New Revision: 187168 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187168 Log: PR target/53228 * config/i386/i386.h (X86_ARCH_CMOV): Rename from X86_ARCH_CMOVE. (TARGET_CMOV): Rename from TARGET_CMOVE. (TARGET_CMOVE): New define. * config/i386/i386.c (ix86_option_override_internal): Use TARGET_CMOV. Do not set TARGET_CMOVE here. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/config/i386/i386.h
Author: uros Date: Fri May 4 16:58:16 2012 New Revision: 187169 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187169 Log: Backport from mainline 2012-05-04 Uros Bizjak <ubizjak@gmail.com> PR target/53228 * config/i386/i386.h (X86_ARCH_CMOV): Rename from X86_ARCH_CMOVE. (TARGET_CMOV): Rename from TARGET_CMOVE. (TARGET_CMOVE): New define. * config/i386/i386.c (ix86_option_override_internal): Use TARGET_CMOV. Do not set TARGET_CMOVE here. Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/i386/i386.c branches/gcc-4_7-branch/gcc/config/i386/i386.h
Author: uros Date: Fri May 4 17:48:56 2012 New Revision: 187171 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187171 Log: Backport from mainline 2012-05-04 Uros Bizjak <ubizjak@gmail.com> PR target/53228 * config/i386/i386.h (X86_ARCH_CMOV): Rename from X86_ARCH_CMOVE. (TARGET_CMOV): Rename from TARGET_CMOVE. (TARGET_CMOVE): New define. * config/i386/i386.c (ix86_option_override_internal): Use TARGET_CMOV. Do not set TARGET_CMOVE here. Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/config/i386/i386.c branches/gcc-4_6-branch/gcc/config/i386/i386.h
Author: uros Date: Fri May 4 18:43:10 2012 New Revision: 187172 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187172 Log: Backport from mainline 2012-05-04 Uros Bizjak <ubizjak@gmail.com> PR target/53228 * config/i386/i386.h (X86_ARCH_CMOV): Rename from X86_ARCH_CMOVE. (TARGET_CMOV): Rename from TARGET_CMOVE. (TARGET_CMOVE): New define. * config/i386/i386.c (override_options): Use TARGET_CMOV. Do not set TARGET_CMOVE here. Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/config/i386/i386.c branches/gcc-4_5-branch/gcc/config/i386/i386.h
Fixed everywhere.
*** Bug 55816 has been marked as a duplicate of this bug. ***
*** Bug 48326 has been marked as a duplicate of this bug. ***