Bug 11587 - [3.3 Regression] SH ICE in reload_cse_simplify_operand, postreload.c
: [3.3 Regression] SH ICE in reload_cse_simplify_operand, postreload.c
Status: RESOLVED WONTFIX
Product: gcc
Classification: Unclassified
Component: target
: 3.3
: P2 normal
: 3.3.3
Assigned To: Not yet assigned to anyone
:
: ice-on-valid-code
:
:
  Show dependency treegraph
 
Reported: 2003-07-19 01:05 UTC by Michael Eager
Modified: 2004-02-09 16:06 UTC (History)
3 users (show)

See Also:
Host:
Target: sh4-hardhat-linux
Build:
Known to work:
Known to fail:
Last reconfirmed: 2003-07-19 02:19:07


Attachments
Patch to config/sh.c to fix ICE (630 bytes, patch)
2003-08-29 23:23 UTC, Michael Eager
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Eager 2003-07-19 01:06:00 UTC
ICE in reload_cse_simplify_operands, at postreload.c:378

tst.c:22: error: insn does not satisfy its constraints:
(insn 90 89 63 7 (set (reg:SI 65 fr1 [orig:158 <result> ] [158])
        (reg:SI 147 t)) 123 {movsi_ie} (insn_list 89 (nil))
    (nil))
tst.c:22: internal compiler error: in reload_cse_simplify_operands, at
postreload.c:378

tst.c:
int foo1(void);
int foo2();
int foo3();

static int goo()
        {
        int i;

        if (i <= 0) return i;

        if (foo1() > 1)
                {
                i = foo2();
                if (i < 0) return i;
                if (i)
                        {
                        if (foo3()) return 1;
                        return 0;
                        }
                }

        }
Comment 1 Andrew Pinski 2003-07-19 02:19:06 UTC
Note you forgot to mention what options you used, -O1 was enough to reproduce
this.

I can confirm this on 3.3.1 (20030714) and the mainline (20030718).
Comment 2 Michael Eager 2003-08-29 23:23:19 UTC
Created attachment 4678 [details]
Patch to config/sh.c to fix ICE

2003-08-29  Michael Eager <eager@mvista.com>

*	config/sh/sh.c (sh_register_move_cost): avoid t-reg as dest
Comment 3 dank 2003-09-14 21:16:28 UTC
This did not occur in Hard Hat 2.0's gcc-2.97, nor in dodes' gcc-3.0.2,
so IMHO this is a regression.  I'll submit a patch to add this test to
the testsuite.  Thanks!
Comment 4 Andrew Pinski 2003-09-14 22:39:25 UTC
The patch seems simple enough for 3.3.2 (note I cannot approve anything).
Comment 5 dank 2003-09-15 15:56:48 UTC
Fix works for me in gcc-3.3.1 as released (haven't tried applying it to branch
yet).
Comment 6 dank 2003-09-15 17:44:47 UTC
I've prepared a patch to add a testcase for this PR to the testsuite; see
http://www.kegel.com/crosstool/current/patches/gcc-3.3.1/pr11587-1-test.patch
I'll submit it to gcc-patches in a couple days if nobody squawks.

BTW, the fix for bug 11587 seemed to fix bug 11162 for me.
Comment 7 Mark Mitchell 2003-10-16 09:23:44 UTC
Postponed until GCC 3.3.3.
Comment 8 Gabriel Dos Reis 2003-12-21 20:49:06 UTC
Joern --
Can you comment on the patch provided in the audit trail?
Thanks,

-- Gaby
Comment 9 Andrew Pinski 2003-12-26 18:25:00 UTC
This no longer ICEs on the mainline.
Comment 10 renneckej@superh.com 2004-01-06 12:30:52 UTC
Subject: Re:  [3.3 Regression] SH ICE in reload_cse_simplify_operand,
postreload.c

The patch tests the wrong condition.  A copy from T to a general purpose
register is unproblematic and cheap.  The need for a secondary reload
arises on the contrary when the other class is not a general purpose register.
See how FPSCR_REGS is handled.
Comment 11 Gabriel Dos Reis 2004-01-14 08:16:26 UTC
won't fix before 3.3.3
Comment 12 Gabriel Dos Reis 2004-01-21 04:11:45 UTC
Proposed patch is wrong and the problem is fixed in 3.4.x.
Proper patch for 3.3.x is unlikely.
Comment 13 dank 2004-02-09 16:06:06 UTC
I was surprised and pleased to see that my testcase for this bug
passes if you apply SUGIOKA Toshinobu's backport of the fix for PR13260 to
gcc-3.3.3 (mis-archived as
http://www.m17n.org/linux-sh/ml/linux-sh/2003-02/msg00014.html)!

So those of you using gcc-3.3.3 might want to apply that patch.
In fact, maybe we should consider applying it to gcc-3.3.3 in cvs before release...