This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix infinite recursion (was: Re: Ping: [PATCH] PR 30315 Canonicalize overflow checks in simplify-rtx.c)
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 10 Sep 2007 09:31:00 +0200
- Subject: Fix infinite recursion (was: Re: Ping: [PATCH] PR 30315 Canonicalize overflow checks in simplify-rtx.c)
> Date: Mon, 10 Sep 2007 02:55:06 +0200
> From: Hans-Peter Nilsson <hp@axis.com>
> (I'll commit as obvious after trunk fails on my x86_64 host or
> if it passes regtest. I won't be sorry if someone beats me to
> it.)
No regressions or changes in warnings for
x86_64-unknown-linux-gnu, fixed the problem for cris-elf, so
committed.
* simplify-rtx.c (simplify_relational_operation_1): For recent
canonicalization, don't recurse if op1 equals both PLUS arguments.
Index: simplify-rtx.c
===================================================================
--- simplify-rtx.c (revision 128320)
+++ simplify-rtx.c (working copy)
@@ -3816,7 +3816,9 @@
/* Canonicalize (LTU/GEU (PLUS a b) b) as (LTU/GEU (PLUS a b) a). */
if ((code == LTU || code == GEU)
&& GET_CODE (op0) == PLUS
- && rtx_equal_p (op1, XEXP (op0, 1)))
+ && rtx_equal_p (op1, XEXP (op0, 1))
+ /* Don't recurse "infinitely" for (LTU/GEU (PLUS b b) b). */
+ && !rtx_equal_p (op1, XEXP (op0, 0)))
return simplify_gen_relational (code, mode, cmp_mode, op0, XEXP (op0, 0));
if (op1 == const0_rtx)
brgds, H-P