From patchwork Thu Jun 18 13:08:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1312082 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49nj1v0Wjtz9sRh for ; Thu, 18 Jun 2020 23:09:06 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0C80393C896; Thu, 18 Jun 2020 13:09:02 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id AD3C13870852 for ; Thu, 18 Jun 2020 13:08:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AD3C13870852 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Tobias_Burnus@mentor.com IronPort-SDR: 72uTG3eJKinXsjwtFrDiLpxKJY16des2s0Bbje2krPJW7NI1XrsG2+W2wte50Q1Yg5/OF5YSli knNFu0jt/8vVJg8s0p2BNu6kOycfsnSP2/OvVu7KineOSTyIy/GoyNvxX1sfiLKLMhfxi1qsCC 2HTQpvCB8ec4E9eAPPUocK/YCjXDtZ1mNHt2mBP/KKG8rT+ZfAWwxyN85HdlvVNe6kcozXnrFR LH0wqOUNE2T97kvm72IT9XKV9iJHc1HsCAR/q6+7s7KDJ1Z4dfJG9NTqKTpmSnamPNuaMuzEDZ g2A= X-IronPort-AV: E=Sophos;i="5.73,526,1583222400"; d="diff'?scan'208";a="52090449" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa1.mentor.iphmx.com with ESMTP; 18 Jun 2020 05:08:58 -0800 IronPort-SDR: rmpDENSgLFryHg9wYUPc3Jwzcdvn3oBIyj7AnJ/1IT6CrSUKD2XxbeibAuO7sLytFddDZsO0BN IZdkfiLO/eW3lP9G9gXG4X28JeO4kFENdLPTVRHVK376V47XOqMb6Ccx+uVD1H2rU2Hb0zDYi+ AsN4NfLuZO3SWL6d5XUlqdqDtg3nRmbxclxfiYp9dC+j6MGpOi/Xcl85Ltp1w7NMAn9rYsNTet nrnHXxn3Axd0ugP4jeYeaILSWWtsSyQ5pygbokNL6P+BDTABTonm+5fhrJAI7cAusYg6SCsUn9 scM= To: gcc-patches , Jakub Jelinek From: Tobias Burnus Subject: [Patch]O penMP/Fortran: Reject allocatable components in map clause Message-ID: <5ef0cf2a-1ae5-e73e-2b79-7fb9c637f1f3@codesourcery.com> Date: Thu, 18 Jun 2020 15:08:53 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Language: en-US 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=-14.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" OpenMP 4.5 does not permit allocatable components in list items of the map clause. (OpenMP 5 does.) As OpenMP 5 support is not implemented, let's avoid generating wrong code by diagnosing this (until implemented). OK? Tobias PS: I wonder whether something similar is needed for 'private' and 'firstprivate' on target. The allocatable-component restriction is only in the 'map' clause. However, private/firstprivate have the same issue. (Except that it is much less likely that a user puts a complicated variable in 'private' or 'firstprivate'.) PPS: Not only the OpenMP 5 changes are not yet supported, also some mapping clause support for OpenMP 4.5 is still missing on the Fortran side. ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter OpenMP/Fortran: Reject allocatable components in map clause gcc/fortran/ChangeLog: * openmp.c (resolve_omp_clauses): Reject vars with allocatable components in OpenMP map clauses. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/map-alloc-comp-1.f90: New test. diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 94522d16e6d..e681903c7c2 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -4636,6 +4636,13 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses, && n->sym->as->type == AS_ASSUMED_SIZE) gfc_error ("Assumed size array %qs in %s clause at %L", n->sym->name, name, &n->where); + if (!openacc + && list == OMP_LIST_MAP + && n->sym->ts.type == BT_DERIVED + && n->sym->ts.u.derived->attr.alloc_comp) + gfc_error ("List item %qs with allocatable components is not " + "permitted in map clause at %L", n->sym->name, + &n->where); if (list == OMP_LIST_MAP && !openacc) switch (code->op) { diff --git a/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90 b/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90 new file mode 100644 index 00000000000..0c4429677bd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90 @@ -0,0 +1,14 @@ +! +! ALLOCATABLE COMPONENTS: +! - OpenMP 5: Permitted (and automatically recursively mapped) +! -> Not yet supported. +! - OpenMP 4.5: Not permitted. +! +implicit none (type, external) +type sct + integer, allocatable :: c +end type +type(sct) var + +!$omp target enter data map(to:var) ! { dg-error "allocatable components is not permitted in map clause" } +end