From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4772 invoked by alias); 28 Jul 2010 07:46:12 -0000 Received: (qmail 4761 invoked by uid 22791); 28 Jul 2010 07:46:11 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (212.99.106.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 28 Jul 2010 07:46:03 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 209C5CB02C1 for ; Wed, 28 Jul 2010 09:45:58 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UD4TyejHAZlq for ; Wed, 28 Jul 2010 09:45:58 +0200 (CEST) Received: from adijon-256-1-10-239.w81-51.abo.wanadoo.fr (ADijon-256-1-10-239.w81-51.abo.wanadoo.fr [81.51.49.239]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id E60E2CB02C3 for ; Wed, 28 Jul 2010 09:45:57 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: Fix PR middle-end/44993 Date: Wed, 28 Jul 2010 07:53:00 -0000 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_0/9TMo2Cnu7d8ga" Message-Id: <201007280944.52575.ebotcazou@adacore.com> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg02145.txt.bz2 --Boundary-00=_0/9TMo2Cnu7d8ga Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 1386 This is the bootstrap failure on SPARC64/Linux introduced by the fix for PR middle-end/44790, which was a bootstrap failure on IA-64/HP-UX introduced by the mem-ref2 merge. The fix introduced a non-canonical expansion for MEM_REF via POINTER_PLUS_EXPR which bypasses checks for valid addresses in the SPARC back-end: name = MEM[(struct exp_ch3__make_predefined_primitive_specs__B_99__stream_op_tss_names___PAD *)D.14526_1156 + 4294967296B]; is expanded into sethi %hi(stream_op_tss_names.6060+4294967296), %l2 or %l2, %lo(stream_op_tss_names.6060+4294967296), %l2 which overflows since sethi is a 32-bit operator. This can very likely happen for other back-ends as well so I think that the best approach is to fix PR middle-end/44790 more canonically. The problem was that: op0 = expand_expr (base, NULL_RTX, address_mode, EXPAND_NORMAL); assumed that op0 was generated in address_mode; this isn't guaranteed so an explicit address conversion is required: op0 = convert_memory_address_addr_space (address_mode, op0, as); Bootstrapped/regtested on SPARC64/Linux, applied on the mainline as obvious. 2010-07-28 Eric Botcazou PR middle-end/44790 PR middle-end/44993 * expr.c (expand_expr_real_1) : Revert latest change. Make sure the base has address_mode before adding the offset. -- Eric Botcazou --Boundary-00=_0/9TMo2Cnu7d8ga Content-Type: text/x-diff; charset="iso 8859-15"; name="pr44993.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr44993.diff" Content-length: 980 Index: expr.c =================================================================== --- expr.c (revision 162566) +++ expr.c (working copy) @@ -8730,11 +8730,14 @@ 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, VOIDmode, EXPAND_NORMAL); + op0 = convert_memory_address_addr_space (address_mode, op0, as); if (!integer_zerop (TREE_OPERAND (exp, 1))) - 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); + { + rtx off + = immed_double_int_const (mem_ref_offset (exp), address_mode); + op0 = simplify_gen_binary (PLUS, address_mode, op0, off); + } op0 = memory_address_addr_space (mode, op0, as); temp = gen_rtx_MEM (mode, op0); set_mem_attributes (temp, exp, 0); --Boundary-00=_0/9TMo2Cnu7d8ga--