The attached testcase distilled from elfxx-mips.c gives an ICE with -O1 and above. /src/tmp/mips_miscompile.i:16: error: unrecognizable insn: (insn:HI 12 14 13 0 (set (subreg:SI (reg:DI 120) 4) (plus:SI (mem/s:SI (reg/v/f:SI 119 [ s ]) [4 <variable>.size+0 S4 A32]) (const_int -16 [0xfffffffffffffff0]))) -1 (insn_list:REG_DEP_TRUE 6 (insn_list:REG_DEP_TRUE 14 (nil))) (nil)) /src/tmp/mips_miscompile.i:16: internal compiler error: in extract_insn, at recog.c:2020
Created attachment 8279 [details] testcase
Confirmed, also fails on ppc-darwin.
Werid it does not ICE with my tree combiner, but that is because we remove the cast to "long long". I think there is expand problem but I could be wrong.
Note this is very hard to get a testcase which fails before 4.0 but that is because we would remove the cast to "long long" as fold removes it.
This worked with 20041104 and 20041214's 4.0 so this is a new regression. Before (in 20041214), we did the load the following way: (insn 12 10 13 1 (set (reg:SI 122) (mem/s/j:SI (reg/v/f:SI 119 [ s ]) [0 <variable>.size+0 S4 A32])) -1 (nil) (nil)) (insn 13 12 15 1 (set (reg:SI 121) (plus:SI (reg:SI 122) (const_int -16 [0xfffffffffffffff0]))) -1 (nil) (nil)) (insn 15 13 17 1 (set (reg:SI 123) (const_int 0 [0x0])) -1 (nil) (nil)) (insn 17 15 14 1 (clobber (reg:DI 120)) -1 (nil) (insn_list:REG_LIBCALL 18 (nil))) (insn 14 17 16 1 (set (subreg:SI (reg:DI 120) 4) (reg:SI 121)) -1 (nil) (nil)) (insn 16 14 18 1 (set (subreg:SI (reg:DI 120) 0) (reg:SI 123)) -1 (nil) (nil)) But now we get: (insn 12 14 13 1 (set (subreg:SI (reg:DI 120) 4) (plus:SI (mem/s/j:SI (reg/v/f:SI 119 [ s ]) [0 <variable>.size+0 S4 A32]) (const_int -16 [0xfffffffffffffff0]))) -1 (nil) (nil)) (insn 13 12 15 1 (set (subreg:SI (reg:DI 120) 0) (const_int 0 [0x0])) -1 (nil) (nil)) So either expand is wrong for doing that or the target should understand the subreg.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01592.html>.
Subject: Bug 20203 CVSROOT: /cvs/gcc Module name: gcc Changes by: amodra@gcc.gnu.org 2005-03-30 03:51:12 Modified files: gcc : ChangeLog builtins.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/compile: pr20203.c Log message: PR target/20203 * builtins.c (get_memory_rtx): Expand address exp using EXPAND_NORMAL. Remove convert_memory_address call duplicating that in memory_address. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8021&r2=2.8022 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&r1=1.447&r2=1.448 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5235&r2=1.5236 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr20203.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 20203 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: amodra@gcc.gnu.org 2005-03-30 04:00:45 Modified files: gcc : ChangeLog builtins.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/compile: pr20203.c Log message: PR target/20203 * builtins.c (get_memory_rtx): Expand address exp using EXPAND_NORMAL. Remove convert_memory_address call duplicating that in memory_address. 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.92&r2=2.7592.2.93 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/builtins.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.426&r2=1.426.2.1 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.77&r2=1.5084.2.78 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr20203.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1
Fixed 4.0 and 4.1