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: r164549
This commit is contained in:
Jakub Jelinek 2010-09-23 09:41:30 +02:00 committed by Jakub Jelinek
parent 585b607776
commit 26f67c311c
4 changed files with 38 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2010-09-23 Jakub Jelinek <jakub@redhat.com>
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.
2010-09-22 Eric Botcazou <ebotcazou@adacore.com>
PR target/35664

View File

@ -8279,7 +8279,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 modes are integral, then we can convert from one to the
other. */

View File

@ -1,3 +1,8 @@
2010-09-23 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/45728
* gcc.c-torture/compile/pr45728.c: New test.
2010-09-22 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Backport from mainline

View File

@ -0,0 +1,17 @@
/* PR rtl-optimization/45728 */
union U
{
int *m;
double d;
};
int i;
union U u;
int
foo (void)
{
union U v = { &i };
return u.d == v.d;
}