From patchwork Wed Aug 31 10:10:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chung-Lin Tang X-Patchwork-Id: 664491 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sPLjv6MlSz9sxS for ; Wed, 31 Aug 2016 20:10:25 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=pyV9rU6w; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type; q=dns; s=default; b=d/9b/sd8vXnMsVCfC6QtPv6uN03RNrOQk62VAzWaNdPXGisynp ukDt2RaGrXctjiOpAqwVncXbV9rBtlfgB3ttHAKQtnUf/TyHyO5C+Opoi46XiC1N MTAzVH3EZaCUkZQ0dw0q1bG/qGeWMwXlshLmQtVlpsQrwCMualuB9nV8Q= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type; s= default; bh=d0eu2Xgn+52gpVMIbnHMOJr0qI4=; b=pyV9rU6w77xGLI+g7OCW JfNQxx37odEGKKNmJb77LR3YdbgCCwrsE9R6qu5l6HlQSoJ5B9lAWuA8Zh8bPLll GphEN8HQl8j75cn5sZuSUuqn1NqGXS4pdlPuHh8iqktIkP0Fa+jpd7VLogdgMYQl dwoWua90DWMEn0WaFXwa1uA= Received: (qmail 69989 invoked by alias); 31 Aug 2016 10:10:16 -0000 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 Received: (qmail 69974 invoked by uid 89); 31 Aug 2016 10:10:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=no version=3.3.2 spammy=1n, dump_file, H*r:ip*0.0.0.0, H*r:0.0.0 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 31 Aug 2016 10:10:14 +0000 Received: from svr-orw-fem-04.mgc.mentorg.com ([147.34.97.41]) by relay1.mentorg.com with esmtp id 1bf2TB-0000yC-UQ from ChungLin_Tang@mentor.com ; Wed, 31 Aug 2016 03:10:09 -0700 Received: from [0.0.0.0] (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.3.224.2; Wed, 31 Aug 2016 03:10:09 -0700 From: Chung-Lin Tang Subject: [patch] Fix PR fortran/72743 To: Richard Biener , =?UTF-8?Q?Martin_Li=c5=a1ka?= CC: gcc-patches Message-ID: <2ebcf9da-519e-e2c7-0a52-779c96323496@codesourcery.com> Date: Wed, 31 Aug 2016 18:10:08 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 X-IsSubscribed: yes Hi Richard, Martin, this issue is actually sort of like PR 70856, basically the same ICE after IPA-ICF, due to DECL_PT_UIDs not consistent after reaching for the ultimate_alias_target(). The reason this wasn't covered by the PR70856 fix is that, in this case, the DECL_PT_UID was not set in original->decl, evading the condition, and hence the the merged alias doesn't have DECL_PT_UID set, and causes the ICE in the second round of IPA-PTA (under -fopenacc). My fix is to simply remove the DECL_PT_UID_SET_P (original->decl) guard, and allow the DECL_PT_UID to be set using the DECL_UID in this case. Does this fix make sense? Testing does show no regressions, and the PR testcase ICE is fixed. Thanks, Chung-Lin PR fortran/72743 * ipa-icf.c (sem_variable::merge): Remove guard condition for setting DECL_PT_UID (alias->decl). testsuite/ * gfortran.dg/goacc/pr72743.f90: New test. Index: ipa-icf.c =================================================================== --- ipa-icf.c (revision 239624) +++ ipa-icf.c (working copy) @@ -2258,8 +2258,7 @@ sem_variable::merge (sem_item *alias_item) varpool_node::create_alias (alias_var->decl, decl); alias->resolve_alias (original); - if (DECL_PT_UID_SET_P (original->decl)) - SET_DECL_PT_UID (alias->decl, DECL_PT_UID (original->decl)); + SET_DECL_PT_UID (alias->decl, DECL_PT_UID (original->decl)); if (dump_file) fprintf (dump_file, "Unified; Variable alias has been created.\n\n"); Index: testsuite/gfortran.dg/goacc/pr72743.f90 =================================================================== --- testsuite/gfortran.dg/goacc/pr72743.f90 (revision 0) +++ testsuite/gfortran.dg/goacc/pr72743.f90 (revision 0) @@ -0,0 +1,15 @@ +! { dg-do compile } +! { dg-additional-options "-O2" } + +program p + integer, parameter :: n = 8 + integer :: i, z(n) + z = [(i, i=1,n)] + print *, z +end +subroutine s + integer, parameter :: n = 8 + integer :: i, z(n) + z = [(i, i=1,n)] + print *, z +end