diff mbox

patch to fix PR64061

Message ID 5478CE2D.7000907@redhat.com
State New
Headers show

Commit Message

Vladimir Makarov Nov. 28, 2014, 7:34 p.m. UTC
The following patch fixes

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64061

The patch was tested and bootstrapped on x86-64.

Committed as rev. 218171.

2014-11-28  Vladimir Makarov  <vmakarov@redhat.com>

         PR target/64061
         * lra.c (lra_substitute_pseudo): Ignore constant with int mode for
         subreg.

2014-11-28  Vladimir Makarov  <vmakarov@redhat.com>

         PR target/64061
         * gcc.target/i386/pr64061.c: New.
diff mbox

Patch

Index: lra.c
===================================================================
--- lra.c	(revision 218129)
+++ lra.c	(working copy)
@@ -1806,7 +1806,8 @@  lra_substitute_pseudo (rtx *loc, int old
       machine_mode mode = GET_MODE (*loc);
       machine_mode inner_mode = GET_MODE (new_reg);
 
-      if (mode != inner_mode)
+      if (mode != inner_mode
+	  && ! (CONST_INT_P (new_reg) && SCALAR_INT_MODE_P (mode)))
 	{
 	  if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (inner_mode)
 	      || ! SCALAR_INT_MODE_P (inner_mode))
Index: testsuite/gcc.target/i386/pr64061.c
===================================================================
--- testsuite/gcc.target/i386/pr64061.c	(revision 0)
+++ testsuite/gcc.target/i386/pr64061.c	(working copy)
@@ -0,0 +1,21 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -g -fno-dce -fno-tree-dce" } */
+
+extern void *buf;
+
+extern void bar (void);
+
+int
+foo (int i)
+{
+  int j = 0;
+  if (__builtin_setjmp (buf) == 0)
+    {
+      while (1)
+      {
+        j = 1;
+	  bar ();
+	  }
+    }
+  return j ? i : 0;
+}