From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 56AF83858D34; Tue, 16 Jun 2020 22:38:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 56AF83858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Julian_Brown@mentor.com IronPort-SDR: 3eH+Sh9T+OKuomPFhFVvvPAcEVyW6bvaXLxIaJFN4l7niZjvitFZSbprevtLHYBmUVxj7Iu2Yj kzL4zL27tNFZt0pWyCmUq7t1++pYdrbArTq3RyVOrVLYE2cv79rtLekdNi8BeJxsFqp2u2x8Pn 5J/+lN2xf29/FZ7gF1f/HO2s5dVD0o1ojWoSfJUuvqhgDMLHlZpfVn7+vYqMV6igmW/CYccyaE sIJxH5cFBvjJMxP8QkUXMQL0qM3l4bE1fiGFGWqtP4dtZ+P1xVVgXcT5T0hHvpt73CbHI5q5LD weo= X-IronPort-AV: E=Sophos;i="5.73,520,1583222400"; d="scan'208";a="50003695" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 16 Jun 2020 14:38:56 -0800 IronPort-SDR: d48PIm3j4Asi2/yCj437B6YQcaeGRcWN2GXja+aXpQx17knb+XHQx7oErXxDB+V0dz8bB3XUfi jHDBOb1TqA7H+yHmE9oSAd2qNZhh3vIhPBPQczMXtvnDzbp9hehE28ipXDqGy8AaK/fT5x8Orj SRRBeWOWbkcIK5D2uP2J6URoWx+GfP0CdzhDIc7vsjQ8zyAhgbOZbn9otKqAkhlqon4Cy6ndVz k5v1Lgxw+T6jsybEOLKb/KOADjkA9ziFzs4myqFphfQ0tY8nC2OsuduHQZYWyOB81oxglcNjHr gpo= From: Julian Brown To: CC: Thomas Schwinge , , Jakub Jelinek , Tobias Burnus , "Moore, Catherine" Subject: [PATCH 1/9] [OpenACC] Fortran derived-type mapping fix Date: Tue, 16 Jun 2020 15:38:31 -0700 Message-ID: <54822b42a9e8e1d04d447ba5276ed6c7510e51d7.1592343756.git.julian@codesourcery.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-06.mgc.mentorg.com (139.181.222.6) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jun 2020 22:38:57 -0000 This is a slightly-updated version of the patch sent here, with some of Thomas's suggestions incorporated: https://gcc.gnu.org/pipermail/gcc-patches/2020-June/547407.html I'm still assuming this is approved, but including for completeness. Julian ChangeLog gcc/fortran/ * trans-openmp.c (gfc_trans_omp_clauses): Use 'inner' not 'decl' for derived type members which themselves have derived types. gcc/testsuite/ * gfortran.dg/goacc/mapping-tests-3.f90: New test. * gfortran.dg/goacc/mapping-tests-4.f90: New test. --- gcc/fortran/trans-openmp.c | 4 ++-- .../gfortran.dg/goacc/mapping-tests-3.f90 | 15 +++++++++++++++ .../gfortran.dg/goacc/mapping-tests-4.f90 | 17 +++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90 create mode 100644 gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90 diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 7e2f6256c43..02c40fdc660 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -2774,9 +2774,9 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, } else { - OMP_CLAUSE_DECL (node) = decl; + OMP_CLAUSE_DECL (node) = inner; OMP_CLAUSE_SIZE (node) - = TYPE_SIZE_UNIT (TREE_TYPE (decl)); + = TYPE_SIZE_UNIT (TREE_TYPE (inner)); } } else if (lastcomp->next diff --git a/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90 b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90 new file mode 100644 index 00000000000..890ca781967 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-3.f90 @@ -0,0 +1,15 @@ +! { dg-additional-options "-fdump-tree-gimple" } + +subroutine foo + type one + integer i, j + end type + type two + type(one) A, B + end type + + type(two) x + + !$acc enter data copyin(x%A) +! { dg-final { scan-tree-dump-times "omp target oacc_enter_exit_data map\\(struct:x \\\[len: 1\\\]\\) map\\(to:x.a \\\[len: \[0-9\]+\\\]\\)" 1 "gimple" } } +end diff --git a/gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90 b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90 new file mode 100644 index 00000000000..17cc4841d4e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/mapping-tests-4.f90 @@ -0,0 +1,17 @@ +subroutine foo + type one + integer i, j + end type + type two + type(one) A, B + end type + + type(two) x + +! This is accepted at present, although it represents a probably-unintentional +! overlapping subcopy. + !$acc enter data copyin(x%A, x%A%i) +! But this raises an error. + !$acc enter data copyin(x%A, x%A%i, x%A%i) +! { dg-error ".x.a.i. appears more than once in map clauses" "" { target *-*-* } .-1 } +end -- 2.23.0