aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-09-20 22:41:08 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2010-09-20 22:41:08 +0200
commit220c5f0c7f75f556a37f0b8ae25c1f5a3a69240f (patch)
treefd6859a437a2904175c94cfdd0e4b0b0a34c9f46 /gcc/expr.c
parent0a7a6af67e6311a427052ef6fc21f6df72be7b51 (diff)
downloadgcc-220c5f0c7f75f556a37f0b8ae25c1f5a3a69240f.zip
gcc-220c5f0c7f75f556a37f0b8ae25c1f5a3a69240f.tar.gz
gcc-220c5f0c7f75f556a37f0b8ae25c1f5a3a69240f.tar.bz2
re PR rtl-optimization/45728 (ICE: in gen_lowpart_general, at rtlhooks.c:59 at -O1 when comparing union members)
PR rtl-optimization/45728 * expr.c (expand_expr_real_1): If op0 isn't REG or MEM, try gen_lowpart_common first and if that fails, force_reg first before calling gen_lowpart. * gcc.c-torture/compile/pr45728.c: New test. From-SVN: r164456
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index e99eabe..6b56383 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -9381,7 +9381,15 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
{
if (GET_CODE (op0) == SUBREG)
op0 = force_reg (GET_MODE (op0), op0);
- op0 = gen_lowpart (mode, op0);
+ temp = gen_lowpart_common (mode, op0);
+ if (temp)
+ op0 = temp;
+ else
+ {
+ if (!REG_P (op0) && !MEM_P (op0))
+ op0 = force_reg (GET_MODE (op0), op0);
+ op0 = gen_lowpart (mode, op0);
+ }
}
/* If both types are integral, convert from one mode to the other. */
else if (INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (TREE_TYPE (treeop0)))