aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/expr.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 98638fc..970fb7f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/expr.c b/gcc/expr.c
index 6caee3b..548a407 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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