GCC Bugzilla – Bug 11587
[3.3 Regression] SH ICE in reload_cse_simplify_operand, postreload.c
Last modified: 2004-02-09 16:06:06 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; } } }
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).
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
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!
The patch seems simple enough for 3.3.2 (note I cannot approve anything).
Fix works for me in gcc-3.3.1 as released (haven't tried applying it to branch yet).
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.
Postponed until GCC 3.3.3.
Joern -- Can you comment on the patch provided in the audit trail? Thanks, -- Gaby
This no longer ICEs on the mainline.
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.
won't fix before 3.3.3
Proposed patch is wrong and the problem is fixed in 3.4.x. Proper patch for 3.3.x is unlikely.
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...