From patchwork Tue Jan 4 17:30:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 77504 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 45E33B710E for ; Wed, 5 Jan 2011 04:33:47 +1100 (EST) Received: (qmail 32384 invoked by alias); 4 Jan 2011 17:33:39 -0000 Received: (qmail 32341 invoked by uid 22791); 4 Jan 2011 17:33:38 -0000 X-SWARE-Spam-Status: No, hits=-2.0 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; Tue, 04 Jan 2011 17:33:31 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id A4771CB0221 for ; Tue, 4 Jan 2011 18:33:27 +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 b22G40u2APhx for ; Tue, 4 Jan 2011 18:33:27 +0100 (CET) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 7E760CB01FA for ; Tue, 4 Jan 2011 18:33:27 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix PR tree-optimization/47005 Date: Tue, 4 Jan 2011 18:30:19 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201101041830.19491.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 Hi, this is the recent failure of ACATS c62002a at -O2 on platforms that use SJLJ exceptions, for example the ARM. It's an aliasing issue created by IPA-SRA whose fix is the equivalent of: 2010-07-28 Eric Botcazou PR tree-optimization/44885 * tree-sra.c (find_param_candidates): Skip pointer types to arrays with non-aliased component. but for the other special aliasing flag, namely DECL_NONADDRESSABLE_P. Tested on i586-suse-linux, OK for the mainline? 2011-01-04 Eric Botcazou PR tree-optimization/47005 * tree-sra.c (struct access): Add 'non_addressable' bit. (create_access): Set it for a DECL_NONADDRESSABLE_P field. (decide_one_param_reduction): Return 0 if the parameter is passed by reference and one of the accesses in the group is non_addressable. 2011-01-04 Eric Botcazou * gnat.dg/opt14.adb: New test. Index: tree-sra.c =================================================================== --- tree-sra.c (revision 168391) +++ tree-sra.c (working copy) @@ -173,6 +173,9 @@ struct access entirely? */ unsigned total_scalarization : 1; + /* Is this access an access to a non-addressable field? */ + unsigned non_addressable : 1; + /* Is this access currently in the work queue? */ unsigned grp_queued : 1; @@ -815,6 +818,10 @@ create_access (tree expr, gimple stmt, b access->grp_unscalarizable_region = unscalarizable_region; access->stmt = stmt; + if (TREE_CODE (expr) == COMPONENT_REF + && DECL_NONADDRESSABLE_P (TREE_OPERAND (expr, 1))) + access->non_addressable = 1; + return access; } @@ -3665,13 +3672,18 @@ decide_one_param_reduction (struct acces for (; repr; repr = repr->next_grp) { gcc_assert (parm == repr->base); - new_param_count++; + + /* Taking the address of a non-addressable field is verboten. */ + if (by_ref && repr->non_addressable) + return 0; if (!by_ref || (!repr->grp_maybe_modified && !repr->grp_not_necessarilly_dereferenced)) total_size += repr->size; else total_size += cur_parm_size; + + new_param_count++; } gcc_assert (new_param_count > 0);