[forwarded from http://bugs.debian.org/319087] works with 3.3.6 and 3.4 CVS, fails with 4.0 CVS and HEAD: $ gcc-4.0 -O2 -mno-ieee-fp -c bug-319087.c fractal.c: In function 'set_fractalc': fractal.c:314: internal compiler error: in expand_simple_unop, at optabs.c:2049 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. $ gcc-4.1 -O2 -mno-ieee-fp -c bug-319087.c fractal.c: In function 'set_formula': fractal.c:367: error: unrecognizable insn: (jump_insn 109 108 204 18 (parallel [ (set (pc) (if_then_else (ne (reg:XF 86) (mem/s:XF (plus:SI (reg/v/f:SI 63 [ c ]) (const_int 52 [0x34])) [10 <variable>.angle+0 S12 A32])) (label_ref 112) (pc))) (clobber (reg:CCFP 18 fpsr)) (clobber (reg:CCFP 17 flags)) (clobber (scratch:HI)) ]) -1 (nil) (expr_list:REG_BR_PROB (const_int 5000 [0x1388]) (nil))) fractal.c:367: internal compiler error: in extract_insn, at recog.c:2084 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. Original report: I ran into an ICE while building xaos with gcc 4.0 (after working around several other changes that make it FTBFS). joey@dragon:~>gcc -O2 -mno-ieee-fp -c fractal.c -o fractal.o fractal.c: In function ‘combine_methods’: fractal.c:219: internal compiler error: in redirect_branch_edge, at cfgrtl.c:935 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>. zsh: exit 1 gcc -O -mno-ieee-fp -c fractal.c -o fractal.o I've attached fractal.c, which is a preprocessed version of the one from xaos. If I remove either the -O2 or the -mno-ieee-fp options the build succeeds. Other -O options cause the same problem with combined with -mno-ieee-fp, including -Os and regular -O. Another ICE is triggered if I combine a -O flag with -ffast-math: fjoey@dragon:~>gcc -O2 -ffast-math -c fractal.c -o fractal.o fractal.c: In function ‘set_fractalc’: fractal.c:314: internal compiler error: in expand_simple_unop, at optabs.c:2049 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. For Debian GNU/Linux specific bug reporting instructions, see <URL:file:///usr/share/doc/gcc-4.0/README.Bugs>. zsh: exit 1 gcc -O2 -ffast-math -c fractal.c -o fractal.o
Confirmed (at least the ICE in redirect_branch_edge and extract_insn, I cannot reproduce the one in expand_simple_unop). Reduced testcase: ========================= struct A { long double d; }; int foo(struct A *p) { if (p->d) return 1; } ========================= This is related to PR22576.
I was trying to trigger the "unrecognizable insn" bug with gcc-4.1, because this bug should be fixed by the patch in PR22576. I have tested: gcc -O2 -mno-ieee-fp fractal.c gcc -O2 -ffast-math fractal.c gcc -O2 fractal.c gcc -mno-ieee-fp fractal.c gcc -ffast-math fractal.c gcc fractal.c And the same pack of compile options with testcase from comment #1. In all cases, compilation was successful. The compiler was: gcc version 4.1.0 20050716 (experimental), patched with patch from PR22576. I'm updating the summary to reflect this.
Uros' patch for PR22576 indeed fixes the ICEs in redirect_branch and extract_insn on the 4.0 branch and mainline. But I can now confirm the bug in expand_simple_unop, I just had to add -march=i486 to the command line. So here's a reduced testcase (compile with "gcc -O -ffast-math -march=i486"): ==================================== int foo(long double d, int i) { if (d == (long double)i) return 1; } ==================================== Happens on the 4.0 branch and mainline.
Patch here: http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01490.html Patch fixes compilation of testcase from comment #3 and compilation of fractal.c.
Subject: Bug 22585 CVSROOT: /cvs/gcc Module name: gcc Changes by: ian@gcc.gnu.org 2005-09-21 18:39:10 Modified files: gcc : ChangeLog gcc/config/i386: i386.c Log message: PR target/22585 * config/i386/i386.c (ix86_prepare_fp_compare_args): Do not force integer op1 into register for XFmode compares. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9998&r2=2.9999 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.859&r2=1.860
Fixed on the mainline.
Subject: Bug 22585 CVSROOT: /cvs/gcc Module name: gcc Changes by: janis@gcc.gnu.org 2005-09-26 19:19:43 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.target/i386: pr22576.c pr22585.c pr23268.c builtin-apply-mmx.c Log message: 2005-08-26 Uros Bizjak <uros@kss-loka.si> * gcc.target/i386/builtin-apply-mmx.c: New test. PR target/22576 * gcc.target/i386/pr22576.c: New test. PR target/22585 * gcc.target/i386/pr22585.c: New test. PR target/23268 * gcc.target/i386/pr23268.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6104&r2=1.6105 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr22576.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr22585.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr23268.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/builtin-apply-mmx.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 22585 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: uros@gcc.gnu.org 2005-10-07 05:32:37 Modified files: gcc : ChangeLog gcc/config/i386: i386.c sse.md gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.target/i386: pr22576.c pr22585.c pr23570.c Log message: PR target/23570 * config/i386/sse.md (*sse_concatv2sf): Change operand 2 constraint to "reg_or_0_operand". (sse2_loadld): Change operand 1 constraint to "reg_or_0_operand". testsuite/ PR target/22576 * gcc.target/i386/pr22576.c: New test. PR target/22585 * gcc.target/i386/pr22585.c: New test. PR target/23570 * gcc.target/i386/pr23570.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.451&r2=2.7592.2.452 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.795.6.11&r2=1.795.6.12 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/sse.md.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.7.14.2&r2=1.7.14.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.434&r2=1.5084.2.435 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr22576.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.10.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr22585.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.2.10.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr23570.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.20.1
Fixed on 4.0 branch.