[forwarded from http://bugs.debian.org/250899] distilled from the 2.6.7-rc1 kernel, built for sparc-linux (mm/fremap.c), compiled with -O2 or -O3, works with -O0, -O1 3.3 branch, 20040517 or later, 20040429 is reported to work. static __inline__ __attribute__ ((always_inline)) int page_mapping (unsigned flags) { if (1u & (flags >> 16)) return 1; return 0; } void install_page (unsigned flags) { if (__builtin_expect (!page_mapping (flags), 0)) __builtin_trap (); } $gcc -O2 bug-250899.c bug-250899.c: In function `install_page': bug-250899.c:12: error: unrecognizable insn: (insn 53 16 54 0 0x701cf180 (set (reg:SI 112) (zero_extract:SI (reg:SI 110) (const_int 1 [0x1]) (const_int 31 [0x1f]))) -1 (nil) (expr_list:REG_DEAD (reg:SI 110) (nil))) bug-250899.c:12: internal compiler error: in extract_insn, at recog.c:2175 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Confirmed. Critical since it's the Kernel.
Investigating.
The latest version reported to work seems dubious. According to my testing, GCC 3.3.2 compiles the testcase but not GCC 3.3.3.
Ironically, the ICE was introduced/exposed by: 2004-01-11 Jakub Jelinek <jakub@redhat.com> PR middle-end/13392 * builtins.c (expand_builtin_expect_jump): Handle conditional jumps to drop through label. Don't fall back to SCC even when conditional jump has not been found.
Proposed fix: http://gcc.gnu.org/ml/gcc/2004-05/msg01424.html
Created attachment 6439 [details] proposed patch
Subject: Bug 15693 CVSROOT: /cvs/gcc Module name: gcc Changes by: ebotcazou@gcc.gnu.org 2004-05-31 21:34:27 Modified files: gcc : ChangeLog gcc/testsuite : ChangeLog gcc/config/sparc: sparc.c sparc.h sparc.md Added files: gcc/testsuite/gcc.dg: sparc-trap-1.c Log message: PR target/15693 * config/sparc/sparc.c (compare_operand): New predicate. * config/sparc/sparc.h (PREDICATE_CODES): Add it. * config/sparc/sparc.md (cmpsi expander): Use it. If the first operand is a ZERO_EXTRACT and the second operand is not zero, force the former to a register. (cmpdi expander): Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3807&r2=2.3808 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3797&r2=1.3798 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/sparc-trap-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.c.diff?cvsroot=gcc&r1=1.300&r2=1.301 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.h.diff?cvsroot=gcc&r1=1.252&r2=1.253 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.md.diff?cvsroot=gcc&r1=1.201&r2=1.202
Subject: Bug 15693 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: ebotcazou@gcc.gnu.org 2004-05-31 21:40:20 Modified files: gcc : ChangeLog gcc/testsuite : ChangeLog gcc/config/sparc: sparc.c sparc.h sparc.md Added files: gcc/testsuite/gcc.dg: sparc-trap-1.c Log message: PR target/15693 * config/sparc/sparc.c (compare_operand): New predicate. * config/sparc/sparc.h (PREDICATE_CODES): Add it. * config/sparc/sparc.md (cmpsi expander): Use it. If the first operand is a ZERO_EXTRACT and the second operand is not zero, force the former to a register. (cmpdi expander): Likewise. 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.457&r2=2.2326.2.458 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.188&r2=1.3389.2.189 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/sparc-trap-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.271.4.13&r2=1.271.4.14 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.236.6.6&r2=1.236.6.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.md.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.196.2.2&r2=1.196.2.3
Subject: Bug 15693 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: ebotcazou@gcc.gnu.org 2004-05-31 21:45:33 Modified files: gcc : ChangeLog gcc/testsuite : ChangeLog gcc/config/sparc: sparc.c sparc.h sparc.md Added files: gcc/testsuite/gcc.dg: sparc-trap-1.c Log message: PR target/15693 * config/sparc/sparc.c (compare_operand): New predicate. * config/sparc/sparc.h (PREDICATE_CODES): Add it. * config/sparc/sparc.md (cmpsi expander): Use it. If the first operand is a ZERO_EXTRACT and the second operand is not zero, force the former to a register. (cmpdi expander): Likewise. 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.988&r2=1.16114.2.989 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.376&r2=1.2261.2.377 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/sparc-trap-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.4.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.233.4.9&r2=1.233.4.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.215.4.5&r2=1.215.4.6 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.md.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.181.4.10&r2=1.181.4.11
Proposed fix applied.