public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "aron-gcc at sightspeed dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/16584] New: -msse2 also enabling -mfpmath=sse option causing illegal instruction errors Date: Fri, 16 Jul 2004 02:47:00 -0000 [thread overview] Message-ID: <20040716024656.16584.aron-gcc@sightspeed.com> (raw) The gcc command line option -msse2 seems to be implicitly turning on the - mfpmath=sse option. The man pages describe the -msse2 as only enabling the use of SSE2 intrinsics rather than automatic use. This bug is very dangorous since it breaks using runtime detection of SSE2 support. We use the -msse2 option to only generate SSE2 code in areas where we have written intrinsics so that a single binary is platform safe. A simple example is: gcc -msse2 test.c <file test.c> int main(void) { int i = 1; float temp2 = 1.0 * (i*i); // Allow for an optimal sse2 int to float conversion return 0; } <test.s> output .file "test.c" .text .globl main .type main, @function main: pushl %ebp movl %esp, %ebp subl $24, %esp andl $-16, %esp movl $0, %eax addl $15, %eax addl $15, %eax shrl $4, %eax sall $4, %eax subl %eax, %esp movl $1, -4(%ebp) movl -4(%ebp), %eax imull -4(%ebp), %eax cvtsi2sd %eax, %xmm0 cvtsd2ss %xmm0, %xmm0 movss %xmm0, -8(%ebp) movl $0, %eax leave ret .size main, .-main .section .note.GNU-stack,"",@progbits .ident "GCC: (GNU) 3.4.0" <end> Note that the movss, cvtsi2sd and cvtsd2ss instructions are used which should not happen. When this is compiled and run on a Pentium 3 machine a SIGILL is generated. <Additional Information> <file test.i> # 1 "test.c" # 1 "<built-in>" # 1 "<command line>" # 1 "test.c" int main(void) { int i = 1; float temp2 = 1.0 * (i*i); return 0; } <end file> Reading specs from /usr/lib/gcc/i486-slackware-linux/3.4.0/specs Configured with: ../gcc-3.4.0/configure --prefix=/usr --enable-shared --enable- threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose - -target=i486-slackware-linux --host=i486-slackware-linux Thread model: posix gcc version 3.4.0 /usr/libexec/gcc/i486-slackware-linux/3.4.0/cc1 -E -quiet -v test.c -msse2 - mtune=i486 -o test.i ignoring nonexistent directory "/usr/lib/gcc/i486-slackware- linux/3.4.0/../../../../i486-slackware-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc/i486-slackware-linux/3.4.0/include /usr/include End of search list. /usr/libexec/gcc/i486-slackware-linux/3.4.0/cc1 -fpreprocessed test.i -quiet - dumpbase test.c -msse2 -mtune=i486 -auxbase test -version -o test.s GNU C version 3.4.0 (i486-slackware-linux) compiled by GNU C version 3.4.0. GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64518 /usr/lib/gcc/i486-slackware-linux/3.4.0/../../../../i486-slackware- linux/bin/as -V -Qy -o test.o test.s GNU assembler version 2.15.90.0.3 (i486-slackware-linux) using BFD version 2.15.90.0.3 20040415 /usr/libexec/gcc/i486-slackware-linux/3.4.0/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/gcc/i486-slackware- linux/3.4.0/../../../crt1.o /usr/lib/gcc/i486-slackware- linux/3.4.0/../../../crti.o /usr/lib/gcc/i486-slackware-linux/3.4.0/crtbegin.o - L/usr/lib/gcc/i486-slackware-linux/3.4.0 -L/usr/lib/gcc/i486-slackware- linux/3.4.0 -L/usr/lib/gcc/i486-slackware-linux/3.4.0/../../../../i486- slackware-linux/lib -L/usr/lib/gcc/i486-slackware-linux/3.4.0/../../.. test.o - lgcc -lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/gcc/i486-slackware- linux/3.4.0/crtend.o /usr/lib/gcc/i486-slackware-linux/3.4.0/../../../crtn.o Also tested and found under gcc-3.3.4 -- Summary: -msse2 also enabling -mfpmath=sse option causing illegal instruction errors Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: critical Priority: P2 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: aron-gcc at sightspeed dot com CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16584
next reply other threads:[~2004-07-16 2:47 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-07-16 2:47 aron-gcc at sightspeed dot com [this message] 2004-07-16 6:32 ` [Bug c/16584] " pinskia at gcc dot gnu dot org 2004-07-16 17:11 ` aron-gcc at sightspeed dot com 2004-07-16 18:25 ` [Bug target/16584] " pinskia at gcc dot gnu dot org 2004-07-30 17:46 ` aron-gcc at sightspeed dot com 2004-12-24 14:29 ` uros at kss-loka dot si 2004-12-28 15:33 ` uros at kss-loka dot si 2005-01-05 10:00 ` uros at kss-loka dot si
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20040716024656.16584.aron-gcc@sightspeed.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).