From patchwork Tue Sep 7 15:14:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 64030 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 0F20DB6F07 for ; Wed, 8 Sep 2010 01:37:11 +1000 (EST) Received: (qmail 27533 invoked by alias); 7 Sep 2010 15:15:46 -0000 Received: (qmail 27232 invoked by uid 22791); 7 Sep 2010 15:15:29 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, TW_FN 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; Tue, 07 Sep 2010 15:15:01 +0000 Received: from relay1.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 651019417A; Tue, 7 Sep 2010 17:14:58 +0200 (CEST) Date: Tue, 7 Sep 2010 17:14:57 +0200 From: Martin Jambor To: GCC Patches Cc: Jan Hubicka , Richard Guenther Subject: [PATCH, PR 43665] Make IPA-CP punt when type attributes are present Message-ID: <20100907151457.GD30878@virgil.arch.suse.de> Mail-Followup-To: GCC Patches , Jan Hubicka , Richard Guenther MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes 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 small patch prevents IPA-CP from modifying functions that have type attributes because if these describe parameters, they get out of sync after IPA-CP removes those that are constant or unnecessary. IPA-SRA already does exactly the same thing. AFAIK, the patch allows the main fix of PR 43665 to be committed without causing regressions. The proper solutions would be to update the attributes but I believe this should be done only after we unify parameter manipulation, until then this a quick fix preventing miscompilations. The patch has no testcase because after the patch for the actual PR gets in, gfortran.dg/allocatable_scalar_4.f90 will become one. Bootstrapped and tested on x86_64-linux without any regressions, OK for trunk? Thanks, Martin 2010-09-07 Martin Jambor PR fortran/43665 * ipa-cp.c (ipcp_versionable_function_p): Return false if there are any type attributes. Index: icln/gcc/ipa-cp.c =================================================================== --- icln.orig/gcc/ipa-cp.c +++ icln/gcc/ipa-cp.c @@ -427,8 +427,11 @@ ipcp_versionable_function_p (struct cgra { struct cgraph_edge *edge; - /* There are a number of generic reasons functions cannot be versioned. */ - if (!node->local.versionable) + /* There are a number of generic reasons functions cannot be versioned. We + also cannot remove parameters if there are type attributes such as fnspec + present. */ + if (!node->local.versionable + || TYPE_ATTRIBUTES (TREE_TYPE (node->decl))) return false; /* Removing arguments doesn't work if the function takes varargs