diff mbox

Fix PR44790

Message ID alpine.LNX.2.00.1007071440530.1429@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener July 7, 2010, 12:42 p.m. UTC
This fixes PR44790, an issue with expanding the offset operand of
MEM_REFs.  Appearantly things can be complicated here on
ia64-hp-hpux11.23 with -m32 code, so just dispatch to know-good code.

Bootstrapped and tested on x86_64-unknown-linux-gnu (and
ia64-hp-hpux11.23 by Steve), committed.


2010-07-07  Richard Guenther  <rguenther@suse.de>

	PR middle-end/44790
	* expr.c (expand_expr_real_1): Go the POINTER_PLUS_EXPR path
	for expanding the constant offset for MEM_REFs.
diff mbox


Index: gcc/expr.c
--- gcc/expr.c	(revision 161904)
+++ gcc/expr.c	(working copy)
@@ -8777,13 +8777,11 @@  expand_expr_real_1 (tree exp, rtx target
 	  base = build2 (BIT_AND_EXPR, TREE_TYPE (base),
 			 gimple_assign_rhs1 (def_stmt),
 			 gimple_assign_rhs2 (def_stmt));
-	op0 = expand_expr (base, NULL_RTX, address_mode, EXPAND_NORMAL);
 	if (!integer_zerop (TREE_OPERAND (exp, 1)))
-	  {
-	    rtx off;
-	    off = immed_double_int_const (mem_ref_offset (exp), address_mode);
-	    op0 = simplify_gen_binary (PLUS, address_mode, op0, off);
-	  }
+	  base = build2 (POINTER_PLUS_EXPR, TREE_TYPE (base),
+			 base, double_int_to_tree (sizetype,
+						   mem_ref_offset (exp)));
+	op0 = expand_expr (base, NULL_RTX, address_mode, EXPAND_SUM);
 	op0 = memory_address_addr_space (mode, op0, as);
 	temp = gen_rtx_MEM (mode, op0);
 	set_mem_attributes (temp, exp, 0);