Patchwork [committed] Fix RTL checking ICE in var-tracking (PR debug/50827)

login
register
mail settings
Submitter Jakub Jelinek
Date Nov. 21, 2011, 9:10 p.m.
Message ID <20111121211044.GM27242@tyan-ft48-01.lab.bos.redhat.com>
Download mbox | patch
Permalink /patch/126934/
State New
Headers show

Comments

Jakub Jelinek - Nov. 21, 2011, 9:10 p.m.
Hi!

ENTRY_VALUE's argument has '0' format letter instead of 'e', so XEXP
must not be used on it (at least not in RTL checking, otherwise it is the
same).
Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk.

2011-11-21  Jakub Jelinek  <jakub@redhat.com>

	PR debug/50827
	* var-tracking.c (loc_cmp): For ENTRY_VALUEs use ENTRY_VALUE_EXP
	macro instead of XEXP.

	* gcc.dg/pr50827.c: New test.


	Jakub

Patch

--- gcc/var-tracking.c.jj	2011-11-07 12:40:56.000000000 +0100
+++ gcc/var-tracking.c	2011-11-21 17:01:58.470991801 +0100
@@ -3008,7 +3008,7 @@  loc_cmp (rtx x, rtx y)
       if (GET_CODE (y) != ENTRY_VALUE)
 	return 1;
       gcc_assert (GET_MODE (x) == GET_MODE (y));
-      return loc_cmp (XEXP (x, 0), XEXP (y, 0));
+      return loc_cmp (ENTRY_VALUE_EXP (x), ENTRY_VALUE_EXP (y));
     }
 
   if (GET_CODE (y) == ENTRY_VALUE)
--- gcc/testsuite/gcc.dg/pr50827.c.jj	2011-11-21 17:14:29.570529917 +0100
+++ gcc/testsuite/gcc.dg/pr50827.c	2011-11-21 17:14:20.414584530 +0100
@@ -0,0 +1,17 @@ 
+/* PR debug/50827 */
+/* { dg-do compile } */
+/* { dg-options "-g -O2 -funroll-loops" } */
+
+void
+foo (int w, int x, int *y, int *z)
+{
+  float f;
+  while (w--)
+    {
+      f = x;
+      if (y)
+	*y = (__INTPTR_TYPE__) y + w;
+      if (z)
+	*z = w;
+    }
+}