cfgexpand.c (expand_debug_expr): Avoid sign-extending SImode to PSImode.
authorDJ Delorie <dj@redhat.com>
Thu, 12 Sep 2013 17:06:38 +0000 (13:06 -0400)
committerDJ Delorie <dj@gcc.gnu.org>
Thu, 12 Sep 2013 17:06:38 +0000 (13:06 -0400)
* cfgexpand.c (expand_debug_expr): Avoid sign-extending SImode to
PSImode.

From-SVN: r202534

gcc/ChangeLog
gcc/cfgexpand.c

index 0acde62..de4bb3d 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-12  DJ Delorie  <dj@redhat.com>
+
+       * cfgexpand.c (expand_debug_expr): Avoid sign-extending SImode to
+       PSImode.
+
 2013-09-12  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/58389
index 4f10361..88e48c2 100644 (file)
@@ -3154,7 +3154,12 @@ expand_debug_expr (tree exp)
          && GET_MODE (op0) != VOIDmode && GET_MODE (op1) != VOIDmode
          && GET_MODE (op0) != GET_MODE (op1))
        {
-         if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE (op1)))
+         if (GET_MODE_BITSIZE (GET_MODE (op0)) < GET_MODE_BITSIZE (GET_MODE (op1))
+             /* If OP0 is a partial mode, then we must truncate, even if it has
+                the same bitsize as OP1 as GCC's representation of partial modes
+                is opaque.  */
+             || (GET_MODE_CLASS (GET_MODE (op0)) == MODE_PARTIAL_INT
+                 && GET_MODE_BITSIZE (GET_MODE (op0)) == GET_MODE_BITSIZE (GET_MODE (op1))))
            op1 = simplify_gen_unary (TRUNCATE, GET_MODE (op0), op1,
                                      GET_MODE (op1));
          else