From patchwork Fri Dec 30 23:33:24 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 133702 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 8B603B6FBE for ; Sat, 31 Dec 2011 10:55:38 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1325894140; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version:Message-Id: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=e/1SAHJ jO4c2CXrmr9rsuuq3EU4=; b=gWcvqUbdzYRTe+H82Ulr2FeAoox19SARn1Lr632 cCw+20VnOFkvkTVgvCC9CXK23KaviaDnDGPTPpMyFmVGkX7JeZlE4n9tY8G5MPG5 nbcbjqQLWaMZIcnmZy7+oyZNXtHSHVxrNCkb0p75r1SNyTNpOnCgiYYdtHZKZ5/Z 7iEo= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Subject:Date:User-Agent:MIME-Version:Message-Id:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=X+30drDsz0s85T+f+VtNLJYY6ThfJ4VLWHI1lvL9qSDTXRsH5gLc1mBAnTYGrX aeMz1QDjn4jIG2kwmyp8pXixGhS8Am0dly9w1xdTCN0aIZybp26R0FB3Jp4NTBPB /2ElOdjK9WZNsASI6E+QN3x4rxMgwmkVYuqWuwS6ujAqY=; Received: (qmail 19038 invoked by alias); 30 Dec 2011 23:55:33 -0000 Received: (qmail 19030 invoked by uid 22791); 30 Dec 2011 23:55:33 -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) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 30 Dec 2011 23:55:19 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 28E8ECB2738 for ; Sat, 31 Dec 2011 00:55:19 +0100 (CET) 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 TgbVNzopMYHS for ; Sat, 31 Dec 2011 00:55:19 +0100 (CET) Received: from new-host-2.localnet (ADijon-552-1-140-82.w90-13.abo.wanadoo.fr [90.13.243.82]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id D4E3ACB2167 for ; Sat, 31 Dec 2011 00:55:18 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix PR tree-optimization/51624 Date: Sat, 31 Dec 2011 00:33:24 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.34.10-0.4-desktop; KDE/4.4.4; x86_64; ; ) MIME-Version: 1.0 Message-Id: <201112310033.24438.ebotcazou@adacore.com> 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 is the bootstrap failure of the Ada compiler on MIPS/IRIX, a recent regression present on mainline and 4.6 branch. The stage 2 compiler miscompiles the stage 3 compiler (sem_type.adb:Disambiguate) because of an oversight in the fix for PR tree-opt/50569 which changed build_ref_for_model to replicate chains of COMPONENT_REFs instead of just the last ones. The problem is that, when build_ref_for_model is called on the RHS of an aggregate assignment of the form: b1.f1 = b2 with the model associated with a child of the LHS (say b1.f1.f2), it will build something like: MEM [&b2 + -4B].f1.f2 which will wreak havoc downstream. I think that the most straightforward way out is to stop going up the chain of COMPONENT_REFs as soon as the type of the COMPONENT_REF matches that of the base. Bootstrapped on MIPS/IRIX and regtested on x86_64-suse-linux. OK after a full testing cycle? 2011-12-30 Eric Botcazou PR tree-optimization/51624 * tree-sra.c (build_ref_for_model): When replicating a chain of COMPONENT_REFs, stop as soon as the type of the COMPONENT_REF matches that of the base. Index: tree-sra.c =================================================================== --- tree-sra.c (revision 182691) +++ tree-sra.c (working copy) @@ -1478,7 +1478,8 @@ build_ref_for_model (location_t loc, tre expr = TREE_OPERAND (expr, 0); type = TREE_TYPE (expr); - } while (TREE_CODE (expr) == COMPONENT_REF); + } while (TREE_CODE (expr) == COMPONENT_REF + && !types_compatible_p (TREE_TYPE (expr), TREE_TYPE (base))); } t = build_ref_for_offset (loc, base, offset, type, gsi, insert_after);