Hi, i get an ICE with this reduced testcase: ------------------------------------------- typedef struct _Parameters Parameters; typedef double real_T; typedef struct _BlockIO { real_T bio1; real_T bio2; real_T bio3; real_T bio4; real_T bio5; real_T bio6; real_T bio7; real_T bio8; real_T bio9; } BlockIO; struct _Parameters { real_T par1; real_T par2; real_T par3; real_T par4; real_T par5; real_T par6; real_T par7; }; Parameters rtP; BlockIO rtB; void error_func(void) { if (0.0 >= rtP.par1) { // rtB.bio2 = 0.0; } else { rtB.bio2 = rtB.bio1; } if (0.0 >= rtP.par2) { rtB.bio3 = 0.0; } else { rtB.bio3 = 0.0; } rtB.bio4 = rtB.bio3 * rtP.par3; if (0.0 >= rtP.par4) { rtB.bio5 = 0.0; } else { rtB.bio5 = rtB.bio4; } rtB.bio6 = rtB.bio5 * rtP.par5; if (0.0 >= rtP.par6) { // rtB.bio8 = 0.0; } else { rtB.bio8 = rtB.bio7; } rtB.bio9 = rtB.bio5 * rtP.par7; } -------------------------------------------- GCC command line and output: /opt/gcc-3.3.5/bin/gcc -v -c gcc_ice.i -o gcc_ice.o -O1 -fexpensive-optimizations -fcse-follow-jumps -frerun-cse-after-loop -fgcse -march=pentium4 -mfpmath=sse -ffast-math Reading specs from /opt/gcc-3.3.5/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/specs Configured with: ./configure --prefix=/opt/gcc-3.3.5 Thread model: posix gcc version 3.3.5 /opt/gcc-3.3.5/lib/gcc-lib/i686-pc-linux-gnu/3.3.5/cc1 -fpreprocessed gcc_ice.i -quiet -dumpbase gcc_ice.i -march=pentium4 -mfpmath=sse -auxbase-strip gcc_ice.o -O1 -version -fexpensive-optimizations -fcse-follow-jumps -frerun-cse-after-loop -fgcse -ffast-math -o /tmp/ccsHtO1S.s GNU C version 3.3.5 (i686-pc-linux-gnu) compiled by GNU C version 3.2.1. GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64529 gcc_ice.i: In function `error_func': gcc_ice.i:69: internal compiler error: in gen_split_1204, at insn-emit.c:17860 The optimization flags are a subset of "-O2 -march=pentium4 -mfpmath=sse -ffast-math" and I was able to trigger exactly the same ICE with a larger testcase and these flags. Unfortunately the testcase shown here, does not crash with "-O2 -march=pentium4 -mfpmath=sse -ffast-math". I got the same ICE with GCC 3.3.3 and 3.3.1. GCC 3.2.1, GCC 3.4.0 and newer versions do not show this bug. The testcase seems fairly minimal, that is, I cannot remove a single statement or command line flag without loosing the ICE.
Here's a smaller testcase: =============================== double c, d, e; void foo() { if (e-1) d=0; else d=0; c=d; if (e) d=0; } =============================== It crashes GCC 3.3.x when compiled with "-O -frerun-cse-after-loop -ffast-math -march=pentium4 -mfpmath=sse" The testcase crashes GCC 3.2.x, but not GCC 3.1 when compiled with "-O3 -march=pentium4 -mfpmath=sse"
Hi, after looking at the corresponding machine description (GCC 3.3.5, i386.md, line 16619, "Split SSE based moves into sequence") and comparing it with GCC 3.4.0, the bugfix seems to be: --- orig335_i386.md 2004-04-28 17:00:02.000000000 +0000 +++ 335_i386.md 2004-11-11 09:37:14.000000000 +0000 (set (subreg:TI (match_dup 0) 0) (ior:TI (subreg:TI (match_dup 6) 0) (subreg:TI (match_dup 7) 0)))] { - /* If op2 == op3, op3 will be clobbered before it is used. - This should be optimized out though. */ + /* If op2 == op3, op3 would be clobbered before it is used. */ if (operands_match_p (operands[2], operands[3])) - abort (); + { + emit_move_insn (operands[0], operands[2]); + DONE; + } + PUT_MODE (operands[1], GET_MODE (operands[0])); if (operands_match_p (operands[0], operands[4])) operands[6] = operands[4], operands[7] = operands[2]; While searching for the patch that introduced the change, I found PR8555 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8555. This bug is in the RESOLVED/FIXED state, but for some reason the patch was not committed to the 3.2/3.3 branches. Can somebody please take a look at this?
The proposed patch fixes the reduced testcase and my larger testcase that crashes GCC 3.3.5 with "-O2 -march=pentium4 -mfpmath=sse -ffast-math" I have run the C testsuite with no additional failures. If there are no further objections, I would really like to see this bugfix in GCC 3.3.6.
Subject: Re: [3.3 regression] ICE in in gen_split_1204 on i686-pc-linux-gnu target "rgrosseboerger at dspace dot de" <gcc-bugzilla@gcc.gnu.org> writes: | -- | What |Removed |Added | ---------------------------------------------------------------------------- | Severity|normal |critical Would you mind explaining why? -- Gaby
I rated this bug critical, because it occurs with normal C code on a primary platform. My testcase is from automatically generated code, so changing it is quite difficult. In the original PR (PR8555) Volker Reichelt rated the bug "high priority", so I thought "critical" would be OK. Apart from that, I submitted a patch which is almost identical to the patch in PR8555 to gcc-patches@gcc.gnu.org: http://gcc.gnu.org/ml/gcc-patches/2004-12/msg01691.html
Subject: Bug 18402 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: sayle@gcc.gnu.org 2005-01-23 05:16:15 Modified files: gcc : ChangeLog gcc/config/i386: i386.md gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: 20030204-1.c Log message: PR target/18402 Backport from mainline 2003-02-05 Jakub Jelinek <jakub@redhat.com> PR optimization/8555 * config/i386/i386.md (sse_mov?fcc split): Handle op2 == op3 case instead of aborting. * gcc.dg/20030204-1.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.1055&r2=1.16114.2.1056 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.404.2.28&r2=1.404.2.29 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.397&r2=1.2261.2.398 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20030204-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.3.6.1
Fixed.
Subject: Re: [3.3 regression] ICE in in gen_split_1204 on i686-pc-linux-gnu target "rgrosseboerger at dspace dot de" <gcc-bugzilla@gcc.gnu.org> writes: | The proposed patch fixes the reduced testcase and my larger testcase that | crashes GCC 3.3.5 with "-O2 -march=pentium4 -mfpmath=sse -ffast-math" | | I have run the C testsuite with no additional failures. | | If there are no further objections, I would really like to see this bugfix in | GCC 3.3.6. Did you apply the patch? -- Gaby
Subject: RE: [3.3 regression] ICE in gen_split_1204 on i686-pc-linux-gnu target > -----Original Message----- > From: gdr at integrable-solutions dot net > > Did you apply the patch? > > -- Gaby No, Roger did. http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01629.html I haven't tested with a recent GCC 3.3.6 snapshot, but the proposed patch and the one that was integrated are identical as far as I can see.