From patchwork Wed Jul 7 12:42:11 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 58114 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C55D4B6EF0 for ; Wed, 7 Jul 2010 22:42:20 +1000 (EST) Received: (qmail 17493 invoked by alias); 7 Jul 2010 12:42:19 -0000 Received: (qmail 17484 invoked by uid 22791); 7 Jul 2010 12:42:18 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor.suse.de (HELO mx1.suse.de) (195.135.220.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 07 Jul 2010 12:42:13 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id 770859428F for ; Wed, 7 Jul 2010 14:42:11 +0200 (CEST) Date: Wed, 7 Jul 2010 14:42:11 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR44790 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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. Richard. 2010-07-07 Richard Guenther PR middle-end/44790 * expr.c (expand_expr_real_1): Go the POINTER_PLUS_EXPR path for expanding the constant offset for MEM_REFs. 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);