Bug 38208 - [4.4 Regression] gcc.c-torture/compile/20080806-1.c
Summary: [4.4 Regression] gcc.c-torture/compile/20080806-1.c
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-21 05:18 UTC by H.J. Lu
Modified: 2008-11-23 18:57 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
gcc44-pr38208.patch (518 bytes, patch)
2008-11-21 08:43 UTC, Jakub Jelinek
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2008-11-21 05:18:42 UTC
On Linux/x86, revision 142072 gave:

Executing on host: /export/gnu/import/svn/gcc-test/bld/gcc/xgcc -B/export/gnu/import/svn/gcc-test/bld/gcc/   -O3 -fomit-frame-pointer -funroll-loops  -w -c  -m32 -o 20080806-1.o /export/gnu/import/svn/gcc-test/src-trunk/gcc/testsuite/gcc.c-torture/compile/20080806-1.c    (timeout = 300)
/tmp/ccuL0Iug.s: Assembler messages:^M
/tmp/ccuL0Iug.s:9: Warning: 65544 shortened to 8^M

+FAIL: gcc.c-torture/compile/20080806-1.c  -O3 -fomit-frame-pointer  (test for excess errors)
+FAIL: gcc.c-torture/compile/20080806-1.c  -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions  (test for excess errors)
+FAIL: gcc.c-torture/compile/20080806-1.c  -O3 -fomit-frame-pointer -funroll-loops  (test for excess errors)

Revision 142058 is OK.
Comment 1 H.J. Lu 2008-11-21 05:22:20 UTC
Revision 142061 is bad.
Comment 2 H.J. Lu 2008-11-21 05:39:01 UTC
Revision 142061:

http://gcc.gnu.org/ml/gcc-patches/2008-11/msg01051.html

is the cause.
Comment 3 Jakub Jelinek 2008-11-21 08:09:45 UTC
Just the cause that the optimized dump looks differently, but is not wrong.
The bug happens during reload's register elimination.

(insn:HI 6 5 7 2 20080806-1.c:16 (parallel [
            (set (reg:HI 58 [ pretmp.42 ])
                (plus:HI (subreg:HI (reg/f:SI 20 frame) 0)
                    (const_int 136 [0x88])))
            (clobber (reg:CC 17 flags))
        ]) 293 {*addhi_1_lea} (expr_list:REG_UNUSED (reg:CC 17 flags)
        (nil)))

is reloaded into:

(insn 47 5 6 2 20080806-1.c:16 (set (reg:HI 1 dx [orig:58 pretmp.42 ] [58])
        (reg:HI 7 sp)) 53 {*movhi_1} (nil))

(insn:HI 6 47 7 2 20080806-1.c:16 (parallel [
            (set (reg:HI 1 dx [orig:58 pretmp.42 ] [58])
                (plus:HI (reg:HI 1 dx [orig:58 pretmp.42 ] [58])
                    (const_int 65544 [0x10008])))
            (clobber (reg:CC 17 flags))
        ]) 293 {*addhi_1_lea} (expr_list:REG_EQUIV (plus:HI (subreg:HI (plus:SI (reg/f:SI 7 sp)
                    (const_int 65408 [0xff80])) 0)
            (const_int 136 [0x88]))
        (nil)))

eliminate_regs_in_insn calls plus_constant with
to_rtx (subreg:HI (reg/f:SI 7 sp) 0) and offset 0x10008.  I guess it is
eliminate_regs_in_insn and not plus_constant responsibility to trunc_int_for_mode this.
Comment 4 Jakub Jelinek 2008-11-21 08:43:45 UTC
Created attachment 16731 [details]
gcc44-pr38208.patch

I'll test the attached patch.  Related to PR29599.
Comment 5 Jakub Jelinek 2008-11-21 13:48:30 UTC
Subject: Bug 38208

Author: jakub
Date: Fri Nov 21 13:47:05 2008
New Revision: 142088

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142088
Log:
	PR target/38208
	* reload1.c (eliminate_regs_in_insn): For trunc_int_for_mode use
	mode of PLUS, not mode of the eliminated register.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/reload1.c

Comment 6 H.J. Lu 2008-11-21 17:04:19 UTC
Fixed.