Bug 20203 - [4.0/4.1 Regression] unrecognizable insn when using long long and memset
Summary: [4.0/4.1 Regression] unrecognizable insn when using long long and memset
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Alan Modra
URL:
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2005-02-25 00:47 UTC by Alan Modra
Modified: 2005-03-30 04:08 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc-linux, powerpc-darwin
Build:
Known to work: 3.4.4
Known to fail: 4.0.0
Last reconfirmed: 2005-02-25 06:40:27


Attachments
testcase (192 bytes, text/plain)
2005-02-25 00:48 UTC, Alan Modra
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Modra 2005-02-25 00:47:44 UTC
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
Comment 1 Alan Modra 2005-02-25 00:48:29 UTC
Created attachment 8279 [details]
testcase
Comment 2 Andrew Pinski 2005-02-25 01:41:33 UTC
Confirmed, also fails on ppc-darwin.
Comment 3 Andrew Pinski 2005-02-25 01:49:04 UTC
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.
Comment 4 Andrew Pinski 2005-02-25 02:48:09 UTC
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.
Comment 5 Andrew Pinski 2005-02-25 02:57:57 UTC
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.
Comment 6 Andrew Pinski 2005-02-25 12:39:24 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2005-02/msg01592.html>.
Comment 7 GCC Commits 2005-03-30 03:51:23 UTC
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

Comment 8 GCC Commits 2005-03-30 04:00:58 UTC
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

Comment 9 Alan Modra 2005-03-30 04:08:25 UTC
Fixed 4.0 and 4.1