From patchwork Fri Feb 15 18:47:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Brown X-Patchwork-Id: 1043133 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-496297-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FAZMohCL"; dkim-atps=neutral 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 441Mhd5v8xz9sMl for ; Sat, 16 Feb 2019 05:47:56 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=afOPgGCeVI6V2xnu7UQaetDOhUezU/vzSMT/zs7OAhY/RJZmAor0Y WEGnH7CZUzUUUWERq9bGsBiWADrTfgdlSZf9t+RkJ3ydB3NobnJyvcYQLfoVKZ2f NF/lqsNBdafeIN7nhR6zcE4VTKDtSCVQJmHOeBlaFuNdLyV6KjvKKw= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=MxkbPqr1YsRYnnsI2Hs/IWN7RCo=; b=FAZMohCLhLjNthyjgRkZ Dgd7xb9R9iVAta3xbW4PwDF9Cqlgif27sj2FHRn0BUmw/yPuhm5i3N/N/eSlntZI lHz7fbZjNztQ4xI6QqSB7Q4DpVACCdEYGMKGqGoKmeMCVvhcXXx7JIjd5OoKHw3i ePDK2oSHZXoi4nfNXEg/FZY= Received: (qmail 62211 invoked by alias); 15 Feb 2019 18:47:49 -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 62202 invoked by uid 89); 15 Feb 2019 18:47:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Brown, brown 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; Fri, 15 Feb 2019 18:47:47 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1guiWW-00046b-SH from Julian_Brown@mentor.com for gcc-patches@gcc.gnu.org; Fri, 15 Feb 2019 10:47:44 -0800 Received: from squid.athome (137.202.0.90) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 15 Feb 2019 18:47:41 +0000 Date: Fri, 15 Feb 2019 18:47:39 +0000 From: Julian Brown To: , , Chung-Lin Tang Subject: [PATCH, og8] Don't rescan "attach" node for dereferenced struct member Message-ID: <20190215184739.3cc27e70@squid.athome> MIME-Version: 1.0 X-IsSubscribed: yes Hi, The following (og8 branch) patch added support for attaching/detaching from dereferenced struct members: https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01778.html Unfortunately I made a mistake in the portion of that patch that inserts new alloc and firstprivate_pointer nodes for the struct base, meaning that the node rewritten to an attach operation would be scanned again. This is both unnecessary, and can cause problems in some circumstances. Tested with offloading to nvptx, no regressions and the new test passes. I will apply (to the og8 branch) shortly. Thanks, Julian ChangeLog gcc/ * gimplify.c (gimplify_scan_omp_clauses): Avoid scanning 'c' again after creating base-pointer nodes for dereferenced struct. gcc/testsuite/ * gfortran.dg/goacc/derived-types-2.f90: New. commit e374d415801588435d62ac214e0313ffd3ef2198 Author: Julian Brown Date: Thu Feb 14 16:40:21 2019 -0800 [og8] Don't rescan "attach" node for dereferenced struct member gcc/ * gimplify.c (gimplify_scan_omp_clauses): Avoid scanning 'c' again after creating base-pointer nodes for dereferenced struct. gcc/testsuite/ * gfortran.dg/goacc/derived-types-2.f90: New. diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8bf11eb659e..2ff5b68e0cc 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -8289,8 +8289,6 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, *list_p = c2; OMP_CLAUSE_CHAIN (c2) = c3; OMP_CLAUSE_CHAIN (c3) = c; - c = c3; - list_p = &OMP_CLAUSE_CHAIN (c3); struct_deref_set->add (decl); } diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-types-2.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-types-2.f90 new file mode 100644 index 00000000000..d01583fac89 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/derived-types-2.f90 @@ -0,0 +1,14 @@ +module bar + type :: type1 + real(8), pointer, public :: p(:) => null() + end type + type :: type2 + class(type1), pointer :: p => null() + end type +end module + +subroutine foo (var) + use bar + type(type2), intent(inout) :: var + !$acc enter data create(var%p%p) +end subroutine