aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2012-04-04 08:26:34 +0000
committerTristan Gingold <gingold@gcc.gnu.org>2012-04-04 08:26:34 +0000
commit9516c54ee3e407b3ca31244da708582082b830b3 (patch)
tree773efdada664fb057146ad8be1dd1e735e0f3160 /gcc/expr.c
parent62755fd571f16cf1965126c3f169a36fca0d1bf9 (diff)
downloadgcc-9516c54ee3e407b3ca31244da708582082b830b3.zip
gcc-9516c54ee3e407b3ca31244da708582082b830b3.tar.gz
gcc-9516c54ee3e407b3ca31244da708582082b830b3.tar.bz2
expr.c (expand_expr_real_2): Handle larger sizetype in POINTER_PLUS_EXPR.
2012-04-04 Tristan Gingold <gingold@adacore.com> * expr.c (expand_expr_real_2): Handle larger sizetype in POINTER_PLUS_EXPR. From-SVN: r186133
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c5
1 files changed, 5 insertions, 0 deletions
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