From patchwork Mon Dec 20 15:16:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Stubbs X-Patchwork-Id: 49118 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7A5873857C6F for ; Mon, 20 Dec 2021 15:17:11 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id 854D2385783A; Mon, 20 Dec 2021 15:16:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 854D2385783A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com IronPort-SDR: zBEEjdVkTBfCpyqT4ypfZpAokJEDTGYGgVDD0T6oxTmBn2Cza1Xs2MolbdHk6NXDmhINoVRERo fm0zK5YZ/WG1sYF8nd0++iJW+lGDhQl1vlESdt9Tx7kpwDz4MjCiuwGy2Osmp4KfH4gPLr6a+q WkfB+wu4aceA2fTPO6A2LLf37g0NG0svVPjDMK8Cu4Q7jwNBvrY6YhjiPek+o8Ug/b4CXk15t5 zMJ6YZi3N1wyPfH1opIRqGa+yI52bU4rfJI5VH6VpEsDOCQYoA16h9Vhd4/yAzgEXELSqn+hsc +ImMAxV0+xQfPWFzzkL8s18q X-IronPort-AV: E=Sophos;i="5.88,220,1635235200"; d="scan'208";a="69916898" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 20 Dec 2021 07:16:28 -0800 IronPort-SDR: YBg8Cf94jm3KEKVgiYxIywqjQee1VqClDxSqtYzu9ArMR6xw9FTtgFfpDFI0zkinajSKoYr7Jf qF55cd6S8I+M99lB7jMK5hEAvP8TH+SWNuLTq87OXt0je0WO9xV71eafH3ZfRfN8ETyAbShuGF olk8ymA/mjdAiRu6F+cqpVqbOGIZvAbJ/J4M6y74zPZ5IdkhwFQXLT/tdtAu4Eygi0vurhfwAm 1RiE+HtJ8LZPTHAwFIPor0H7z5tQkrvy3yn1Mat9udjmK6U/HZZgZMp9fQeQB21iZBbOL8oNf8 3pE= Message-ID: <39b6e9f5-aa51-c78d-dd51-cb6a6b91e5f9@codesourcery.com> Date: Mon, 20 Dec 2021 15:16:23 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Content-Language: en-GB From: Andrew Stubbs Subject: [PATCH] OpenMP front-end: allow requires dynamic_allocators To: "gcc-patches@gcc.gnu.org" , Fortran List X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-05.mgc.mentorg.com (139.181.222.5) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-11.5 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi all, This patch removes the "sorry" message for the OpenMP "requires dynamic_allocators" feature in C, C++ and Fortran. The clause is supposed to state that the user code will not work without the omp_alloc/omp_free and omp_init_allocator/omp_destroy_allocator and these things *are* present, so there should be no problem allowing it. I can't see any reason for our implementation to *do* anything with this statement -- it's fine for the allocators to work the same with or without it. I think this patch ought to be fine for GCC 12, but if not it can wait until stage 1 opens. I shall backport this to OG11 shortly. OK? Andrew OpenMP: allow requires dynamic_allocators There's no need to reject the dynamic_allocators requires directive because we actually do support the feature, and it doesn't have to actually "do" anything. gcc/c/ChangeLog: * c-parser.c (c_parser_omp_requires): Don't "sorry" dynamic_allocators. gcc/cp/ChangeLog: * parser.c (cp_parser_omp_requires): Don't "sorry" dynamic_allocators. gcc/fortran/ChangeLog: * openmp.c (gfc_match_omp_requires): Don't "sorry" dynamic_allocators. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/requires-8.f90: Reinstate dynamic allocators requirement. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index d7e5f051ac0..808a73f1038 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -22581,7 +22581,7 @@ c_parser_omp_requires (c_parser *parser) c_parser_skip_to_pragma_eol (parser, false); return; } - if (p) + if (p && this_req != OMP_REQUIRES_DYNAMIC_ALLOCATORS) sorry_at (cloc, "%qs clause on % directive not " "supported yet", p); if (p) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c2564e51e41..d55c9675c4e 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -46421,7 +46421,7 @@ cp_parser_omp_requires (cp_parser *parser, cp_token *pragma_tok) cp_parser_skip_to_pragma_eol (parser, pragma_tok); return false; } - if (p) + if (p && this_req != OMP_REQUIRES_DYNAMIC_ALLOCATORS) sorry_at (cloc, "%qs clause on % directive not " "supported yet", p); if (p) diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 2036bc1349f..f47a44f7539 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -5373,7 +5373,8 @@ gfc_match_omp_requires (void) else goto error; - if (requires_clause & ~OMP_REQ_ATOMIC_MEM_ORDER_MASK) + if (requires_clause & ~(OMP_REQ_ATOMIC_MEM_ORDER_MASK + | OMP_REQ_DYNAMIC_ALLOCATORS)) gfc_error_now ("Sorry, %qs clause at %L on REQUIRES directive is not " "yet supported", clause, &old_loc); if (!gfc_omp_requires_add_clause (requires_clause, clause, &old_loc, NULL)) diff --git a/gcc/testsuite/gfortran.dg/gomp/requires-8.f90 b/gcc/testsuite/gfortran.dg/gomp/requires-8.f90 index 3c32ae9860e..eadfcaf8609 100644 --- a/gcc/testsuite/gfortran.dg/gomp/requires-8.f90 +++ b/gcc/testsuite/gfortran.dg/gomp/requires-8.f90 @@ -4,7 +4,7 @@ contains subroutine foo interface subroutine bar2 - !$!omp requires dynamic_allocators + !$omp requires dynamic_allocators end subroutine end interface !$omp target