]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
expr.c (expand_expr_real_2): Handle larger sizetype in POINTER_PLUS_EXPR.
authorTristan Gingold <gingold@adacore.com>
Wed, 4 Apr 2012 08:26:34 +0000 (08:26 +0000)
committerTristan Gingold <gingold@gcc.gnu.org>
Wed, 4 Apr 2012 08:26:34 +0000 (08:26 +0000)
2012-04-04  Tristan Gingold  <gingold@adacore.com>

* expr.c (expand_expr_real_2): Handle larger sizetype in
POINTER_PLUS_EXPR.

From-SVN: r186133

gcc/ChangeLog
gcc/expr.c

index 98638fc2fdf83030c0e1d6fd5eb1be69c598a7d8..970fb7ff3da87e8f89bf09289432300d2b85da1a 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-04  Tristan Gingold  <gingold@adacore.com>
+
+       * expr.c (expand_expr_real_2): Handle larger sizetype in
+       POINTER_PLUS_EXPR.
+
 2012-04-03  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        * config/sh/t-sh (MULTILIB_MATCHES): Match m2a-single-only
index 6caee3be7ac131afe49f422ce4584c68ddaaaf9b..548a407d55e7d20a3fdf9a0b471b8376eb4e8d8e 100644 (file)
@@ -7957,6 +7957,11 @@ expand_expr_real_2 (sepops ops, rtx target, enum machine_mode tmode,
        treeop1 = fold_convert_loc (loc, type,
                                    fold_convert_loc (loc, ssizetype,
                                                      treeop1));
+      /* If sizetype precision is larger than pointer precision, truncate the
+        offset to have matching modes.  */
+      else if (TYPE_PRECISION (sizetype) > TYPE_PRECISION (type))
+       treeop1 = fold_convert_loc (loc, type, treeop1);
+
     case PLUS_EXPR:
       /* If we are adding a constant, a VAR_DECL that is sp, fp, or ap, and
         something else, make sure we add the register to the constant and