re PR debug/48043 (pr47201: var-tracking loc_order_check fails for type punning examples)
authorJakub Jelinek <jakub@redhat.com>
Thu, 10 Mar 2011 18:10:14 +0000 (19:10 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 10 Mar 2011 18:10:14 +0000 (19:10 +0100)
PR debug/48043
* config/s390/s390.c (s390_delegitimize_address): Make sure the
result mode matches original rtl mode.

From-SVN: r170851

gcc/ChangeLog
gcc/config/s390/s390.c

index 12c74a1..ca2a952 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/48043
+       * config/s390/s390.c (s390_delegitimize_address): Make sure the                                                                            
+       result mode matches original rtl mode.
+
 2011-03-10  Nick Clifton  <nickc@redhat.com>
 
        * config/rx/rx.md (bitset_in_memory, bitclr_in_memory: Fix timings.
index 54632dd..4a056d5 100644 (file)
@@ -5027,20 +5027,29 @@ s390_delegitimize_address (rtx orig_x)
       y = XEXP (XEXP (x, 1), 0);
       if (GET_CODE (y) == UNSPEC
          && XINT (y, 1) == UNSPEC_GOT)
-       return XVECEXP (y, 0, 0);
-      return orig_x;
+       y = XVECEXP (y, 0, 0);
+      else
+       return orig_x;
     }
-
-  if (GET_CODE (x) == CONST)
+  else if (GET_CODE (x) == CONST)
     {
       y = XEXP (x, 0);
       if (GET_CODE (y) == UNSPEC
          && XINT (y, 1) == UNSPEC_GOTENT)
-       return XVECEXP (y, 0, 0);
-      return orig_x;
+       y = XVECEXP (y, 0, 0);
+      else
+       return orig_x;
     }
+  else
+    return orig_x;
 
-  return orig_x;
+  if (GET_MODE (orig_x) != Pmode)
+    {
+      y = lowpart_subreg (GET_MODE (orig_x), y, Pmode);
+      if (y == NULL_RTX)
+       return orig_x;
+    }
+  return y;
 }
 
 /* Output operand OP to stdio stream FILE.