Description of Problem: gcc chokes on -mfpmath=sse for certain input files. Version-Release number of selected component (if applicable): gcc-3.2-11 How Reproducible: Compile the attached .c file with '-O3 -march=pentium4 -mfpmath=sse' and watch it ICE. Compiling with '-O3 -march=pentium4' works. Steps to Reproduce: 1. 2. 3. Actual Results: % gcc -v -c -ansi -pedantic -wall -Wpointer-arith -O3 -march=pentium4 mipmap2.c Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2 20021021 (Red Hat Linux 8.0 3.2-11) /usr/lib/gcc-lib/i386-redhat-linux/3.2/cc1 -lang-c -std=c89 -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -D__i386 -D__i386__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE__ -D__MMX__ -D__SSE2__ mipmap2.c -quiet -dumpbase mipmap2.c -march=pentium4 -ansi -O3 -Wall -Wpointer-arith -pedantic -ansi -version -o /tmp/cc4adZ8c.s GNU CPP version 3.2 20021021 (Red Hat Linux 8.0 3.2-11) (cpplib) (i386 Linux/ELF) GNU C version 3.2 20021021 (Red Hat Linux 8.0 3.2-11) (i386-redhat-linux) compiled by GNU C version 3.2 20021021 (Red Hat Linux 8.0 3.2-11). ignoring nonexistent directory "/usr/i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc-lib/i386-redhat-linux/3.2/include /usr/include End of search list. as -V -Qy -o mipmap2.o /tmp/cc4adZ8c.s GNU assembler version 2.13.90.0.2 (i386-redhat-linux) using BFD version 2.13.90.0.2 20020802 % gcc -v -c -ansi -pedantic -Wall -Wpointer-arith -O3 -march=pentium4 -mfpmath=sse mipmap2.c Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux Thread model: posix gcc version 3.2 20021021 (Red Hat Linux 8.0 3.2-11) /usr/lib/gcc-lib/i386-redhat-linux/3.2/cc1 -lang-c -std=c89 -v -D__GNUC__=3 -D__GNUC_MINOR__=2 -D__GNUC_PATCHLEVEL__=0 -D__GXX_ABI_VERSION=102 -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -D__i386 -D__i386__ -D__pentium4 -D__pentium4__ -D__tune_pentium4__ -D__SSE__ -D__MMX__ -D__SSE2__ mipmap2.c -quiet -dumpbase mipmap2.c -march=pentium4 -mfpmath=sse -ansi -O3 -Wall -Wpointer-arith -pedantic -ansi -version -o /tmp/cccoGHwk.s GNU CPP version 3.2 20021021 (Red Hat Linux 8.0 3.2-11) (cpplib) (i386Linux/ELF) GNU C version 3.2 20021021 (Red Hat Linux 8.0 3.2-11) (i386-redhat-linux) compiled by GNU C version 3.2 20021021 (Red Hat Linux 8.0 3.2-11). ignoring nonexistent directory "/usr/i386-redhat-linux/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/lib/gcc-lib/i386-redhat-linux/3.2/include /usr/include End of search list. mipmap2.c: In function `halve1Dimage_float': mipmap2.c:41: unable to find a register to spill in class `FLOAT_REGS' mipmap2.c:41: this is the insn: (insn 108 106 111 (set (subreg:SF (reg/v:DI 22 rxmm1 [73]) 0) (float:SF (reg:DI 0 rax [89]))) 170 {*floatdisf2_i387_only} (insn_list 105 (nil)) (expr_list:REG_DEAD (reg:DI 0 rax [89]) (nil))) mipmap2.c:41: confused by earlier errors, bailing out Expected Results: Completion of compile. Additional Information: Yes, I know it's massive casting abuse. Tell it to the XFree86 crew ;) But even with that, it shouldn't get into a "bailing out" state when optimizing. If there's actually an *illegal* cast, it should diagnose with an error even at lower optimizations. This *may* be a duplicate of a previous report (which I thought I filed but can't find now). If so, feel free to mark the original "still broken in 3.2-11".
Created attachment 83529 [details] Source file for -mfpmath=sse abort
Simplified into: /* { dg-do compile } */ /* { dg-options "-O2" } */ /* { dg-options "-O2 -march=pentium4 -mfpmath=sse" { target i?86-*-* } } */ void foo (unsigned x, unsigned char *y, float *z) { int i; for (i = 0; i < x; i++) { float ff[2]; ff[0] = ((unsigned) y[3]) << 24 | y[0]; *z = ff[0]/2.0; z++; y += 10; } } Fails with gcc-3.2-12 and gcc 3.3 20021113 too.
No longer reproducible in gcc-3.3-5.