aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2014-02-11 13:58:46 +0000
committerJeff Law <law@redhat.com>2014-02-11 13:58:46 +0000
commitf567f62459f04b51c818d86840e511547d3568be (patch)
tree38c201a84cc798976a515d8d0938e4c6456ab86d /gcc/expr.c
parent8beced20f277a5ccb3d4e4a2458005dd3c0fd498 (diff)
PR middle-end/54041
* expr.c (expand_expr_addr_expr_1): Handle expand_expr returning an object with an undesirable mode. PR middle-end/54041 * gcc.target/m68k/pr54041.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@207689 138bc75d-0d04-0410-961f-82ee72b054a4
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 c1f67f4e4a0..f6708da20d9 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7708,6 +7708,11 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
modifier == EXPAND_INITIALIZER
? EXPAND_INITIALIZER : EXPAND_NORMAL);
+ /* expand_expr is allowed to return an object in a mode other
+ than TMODE. If it did, we need to convert. */
+ if (GET_MODE (tmp) != VOIDmode && tmode != GET_MODE (tmp))
+ tmp = convert_modes (tmode, GET_MODE (tmp),
+ tmp, TYPE_UNSIGNED (TREE_TYPE (offset)));
result = convert_memory_address_addr_space (tmode, result, as);
tmp = convert_memory_address_addr_space (tmode, tmp, as);