GCC Bugzilla will be upgraded from version 4.4.9 to 5.0rc3 on Saturday, April 25, starting around 17:00 UTC. The upgrade process should only last a few minutes. Check bug 64968 for details.
Bug 17113 - [3.4 Regression] ICE with SSE2 intrinsics
[3.4 Regression] ICE with SSE2 intrinsics
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: target
3.4.1
: P2 normal
: 3.4.2
Assigned To: Paolo Bonzini
: ice-on-valid-code, monitored
: 17197 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-08-19 23:59 UTC by Bob van Manen
Modified: 2004-10-30 21:10 UTC (History)
5 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 3.3.3 4.0.0
Known to fail: 3.4.0
Last reconfirmed: 2004-08-20 06:18:58


Attachments
test case (1.46 KB, text/plain)
2004-08-20 00:01 UTC, Bob van Manen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bob van Manen 2004-08-19 23:59:38 UTC
When I compile the following source file using:
$ gcc -march=pentium4 -O2 gccbug-p.cpp

The program breaks with the output seen below. However if I compile it like:
$ gcc -march=pentium4 -O2 -fno-gcse gccbug-p.cpp

Everything is fine.

Output with -march=pentium4 -O2
-------------------------------

Reading specs from /opt/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ./configure --prefix=/opt/gcc-3.4
Thread model: posix
gcc version 3.4.1
 /opt/gcc-3.4/libexec/gcc/i686-pc-linux-gnu/3.4.1/cc1plus -quiet -v
-D_GNU_SOURCE gccbug-p.cpp -quiet -dumpbase gccbug-p.cpp -march=pentium4
-auxbase gccbug-p -O2 -version -o /tmp/cc69Idn4.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/opt/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1
 /opt/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1/i686-pc-linux-gnu
 /opt/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1/backward
 /opt/gcc-3.4/include
 /opt/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4.1/include
 /usr/include
End of search list.
GNU C++ version 3.4.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.2 20040819 (prerelease).
GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129450
gccbug-p.cpp: In function `void test1(int*)':
gccbug-p.cpp:70: error: unrecognizable insn:
(insn:HI 240 4 241 0 (set (reg:V16QI 79 [ __B ])
        (const_vector:V16QI [
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
            ])) -1 (nil)
    (expr_list:REG_EQUAL (const_vector:V16QI [
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
                (const_int 0 [0x0])
            ])
        (nil)))
gccbug-p.cpp:70: internal compiler error: in extract_insn, at recog.c:2083
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Bob van Manen 2004-08-20 00:01:17 UTC
Created attachment 6961 [details]
test case

I took the proprocessed file and removed any unneeded declarations that came in
from emmintrin.h.
Comment 2 Andrew Pinski 2004-08-20 06:18:58 UTC
Confirmed a regression from 3.3.3 but fixed already on the mainline.
Comment 3 Volker Reichelt 2004-08-20 12:43:42 UTC
The failure has nothing to do with GCSE, here's a short example to
demonstrate this. Just compile with "gcc -msse2 -O" to see the crash :-(

=======================================================
typedef int __v4si  __attribute__ ((mode (V4SI)));
typedef int __v16qi __attribute__ ((mode (V16QI)));

void foo(int* p)
{
    int i;

    for ( i=0; i<2; ++i )
    {
        __v16qi v0, v1=(__v16qi)__builtin_ia32_setzero128();
        v0 = __builtin_ia32_punpckhbw128(v0, v1);
        __builtin_ia32_stored (p, (__v4si)v0);
    }
}
=======================================================

The bug was fixed on mainline by Paolo Bonzini's patch
http://gcc.gnu.org/ml/gcc-cvs/2004-07/msg00949.html

It should probably be applied to the 3.4 branch as well,
although I did not try that yet.
Comment 4 Bob van Manen 2004-08-20 17:35:22 UTC
I just applied the patch from Paolo Bonzini to a fresh 3.4.1-release tree and it
fixes this bug. 
Comment 5 Mark Mitchell 2004-08-20 18:21:24 UTC
This patch is OK for 3.4.2.
Comment 6 Volker Reichelt 2004-08-23 08:02:08 UTC
Paolo, could you please apply your patch to the 3.4 branch?
Thanks!
Comment 7 paolo.bonzini@polimi.it 2004-08-23 08:07:10 UTC
Subject: Re:  [3.4 Regression] ICE with SSE2 intrinsics

> Paolo, could you please apply your patch to the 3.4 branch?
> Thanks!

Yes, will do soon.  Thanks for reminding me.

Paolo

Comment 8 CVS Commits 2004-08-24 10:51:30 UTC
Subject: Bug 17113

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	bonzini@gcc.gnu.org	2004-08-24 10:51:04

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386.md 

Log message:
	2004-08-24  Paolo Bonzini  <bonzini@gnu.org>
	
	PR target/17113
	* config/i386/i386.md (movv16qi_internal): Fix typo.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.592&r2=2.2326.2.593
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.502.2.5&r2=1.502.2.6

Comment 9 Andrew Pinski 2004-08-24 14:21:49 UTC
Fixed.
Comment 10 Andrew Pinski 2004-08-26 04:03:26 UTC
*** Bug 17197 has been marked as a duplicate of this bug. ***