public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* patch to fix PR55672
@ 2013-01-10 20:11 Vladimir Makarov
  0 siblings, 0 replies; only message in thread
From: Vladimir Makarov @ 2013-01-10 20:11 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 543 bytes --]

The following patch fixes

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672

The patch was successfully tested and bootstrapped on x86-64 (with and 
without -fstack-check=generic).

Committed as rev. 195095.

2013-01-10  Vladimir Makarov  <vmakarov@redhat.com>

         PR rtl-optimization/pr55672
         * lra-eliminations.c (mark_not_eliminable): Permit addition with
         const to be eliminable.

2013-01-10  Vladimir Makarov  <vmakarov@redhat.com>

         PR rtl-optimization/pr55672
         * gcc.target/i386/pr55672.c: New.



[-- Attachment #2: pr55672.patch --]
[-- Type: text/x-patch, Size: 1433 bytes --]

Index: lra-eliminations.c
===================================================================
--- lra-eliminations.c	(revision 195058)
+++ lra-eliminations.c	(working copy)
@@ -657,7 +657,7 @@ mark_not_eliminable (rtx x)
     case PRE_MODIFY:
       if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER)
 	/* If we modify the source of an elimination rule, disable
-	   it. Do the same if it is the source and not the hard frame
+	   it.  Do the same if it is the source and not the hard frame
 	   register.  */
 	for (ep = reg_eliminate;
 	     ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
@@ -716,7 +716,10 @@ mark_not_eliminable (rtx x)
 	       ep < &reg_eliminate[NUM_ELIMINABLE_REGS];
 	       ep++)
 	    if (ep->to_rtx == SET_DEST (x)
-		&& SET_DEST (x) != hard_frame_pointer_rtx)
+		&& SET_DEST (x) != hard_frame_pointer_rtx
+		&& (GET_CODE (SET_SRC (x)) != PLUS
+		    || XEXP (SET_SRC (x), 0) != SET_DEST (x)
+		    || ! CONST_INT_P (XEXP (SET_SRC (x), 1))))
 	      setup_can_eliminate (ep, false);
 	}
 
Index: testsuite/gcc.target/i386/pr55672.c
===================================================================
--- testsuite/gcc.target/i386/pr55672.c	(revision 0)
+++ testsuite/gcc.target/i386/pr55672.c	(working copy)
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fstack-check=generic" } */
+
+int main ()
+{
+  int x[8];
+  if (x[0] != 4)
+    __builtin_abort ();
+  return 0;
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-10 20:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-10 20:11 patch to fix PR55672 Vladimir Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).