This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR rtl-opt/38281 ICE in reg_referenced_p with combine
On Tue, Dec 02, 2008 at 08:33:54PM +0100, Eric Botcazou wrote:
> > I guess if it is added after the cc0 setter a few lines below as well,
> > it could work. Can bootstrap/regtest it later tonight.
>
> At least it passes C,C++,Ada regression testing.
Following passed x86_64-linux all,obj-c++,ada bootstrap and regression
testing.
2008-12-03 Eric Botcazou <ebotcazou@adacore.com>
PR rtl-optimization/38281
* combine.c (distribute_notes): When using SET_INSN_DELETED on i2,
set it to NULL.
* gcc.c-torture/compile/pr38281.c: New test.
--- gcc/combine.c.jj 2008-11-10 10:13:47.000000000 +0100
+++ gcc/combine.c 2008-12-03 00:51:34.000000000 +0100
@@ -12653,6 +12653,8 @@ distribute_notes (rtx notes, rtx from_in
distribute_links (LOG_LINKS (tem));
SET_INSN_DELETED (tem);
+ if (tem == i2)
+ i2 = NULL_RTX;
#ifdef HAVE_cc0
/* Delete the setter too. */
@@ -12668,6 +12670,8 @@ distribute_notes (rtx notes, rtx from_in
distribute_links (LOG_LINKS (cc0_setter));
SET_INSN_DELETED (cc0_setter);
+ if (cc0_setter == i2)
+ i2 = NULL_RTX;
}
#endif
}
--- gcc/testsuite/gcc.c-torture/compile/pr38281.c.jj 2008-12-03 00:50:00.000000000 +0100
+++ gcc/testsuite/gcc.c-torture/compile/pr38281.c 2008-12-03 00:50:00.000000000 +0100
@@ -0,0 +1,20 @@
+inline unsigned short
+foo (unsigned short x, unsigned short y)
+{
+ if (y == 0)
+ return x;
+ return x / y;
+}
+
+unsigned short a, b, c;
+
+extern int baz (int, int);
+
+void
+bar (void)
+{
+ int d = 0x3D75D162;
+ a = foo (b > d, baz (0, 1));
+ for (c = 0; c; c = 1)
+ ;
+}
Jakub