From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 147773834E63 for ; Fri, 27 May 2022 15:44:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 147773834E63 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-534-PZxuCQqLPIei74dCG2_ksg-1; Fri, 27 May 2022 11:44:47 -0400 X-MC-Unique: PZxuCQqLPIei74dCG2_ksg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B12F804181; Fri, 27 May 2022 15:44:47 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.33.36.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0F3F1170E8; Fri, 27 May 2022 15:44:46 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 24RFii5x2026149 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 27 May 2022 17:44:44 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 24RFihov2026148; Fri, 27 May 2022 17:44:43 +0200 Date: Fri, 27 May 2022 17:44:43 +0200 From: Jakub Jelinek To: Tobias Burnus , gcc-patches@gcc.gnu.org, fortran Subject: Re: [Patch] OpenMP/Fortran: Add support for enter clause on declare target (was: [committed] openmp: Add support for enter clause on declare target) Message-ID: Reply-To: Jakub Jelinek References: <651ae4c2-9440-b8df-e8af-b14491d45937@codesourcery.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Fri, 27 May 2022 15:44:52 -0000 On Fri, May 27, 2022 at 05:20:08PM +0200, Jakub Jelinek wrote: > 2) move the > else if (n->sym->mark) > gfc_error_now ("Variable at %L mentioned multiple times in " > "clauses of the same OMP DECLARE TARGET directive", > &n->where); > diagnostics earlier, above > else if (n->sym->attr.omp_declare_target > && n->sym->attr.omp_declare_target_link > && list != OMP_LIST_LINK) > and adjust testsuite if needed Note, that matches what the C/C++ FEs do, they also first check for clauses on the same construct and only afterwards do the link vs. to/enter on separate directives. Here is an incremental patch I plan to commit after full testing for the C/C++ FE wording. 2022-05-27 Jakub Jelinek gcc/c/ * c-parser.cc (c_parser_omp_declare_target): If OMP_CLAUSE_LINK was seen first, use "%" or "%" depending on OMP_CLAUSE_ENTER_TO of the current clause, otherwise use "% or %" wording. gcc/cp/ * parser.c (handle_omp_declare_target_clause): If OMP_CLAUSE_LINK was seen first, use "%" or "%" depending on OMP_CLAUSE_ENTER_TO of the current clause, otherwise use "% or %" wording. gcc/testsuite/ * c-c++-common/gomp/declare-target-2.c: Add further tests for mixing of link and to/enter clauses on separate directives. --- gcc/c/c-parser.cc.jj 2022-05-26 23:22:30.312850583 +0200 +++ gcc/c/c-parser.cc 2022-05-27 17:28:59.120420300 +0200 @@ -22067,9 +22067,14 @@ c_parser_omp_declare_target (c_parser *p id = get_identifier ("omp declare target"); if (at2) { - error_at (OMP_CLAUSE_LOCATION (c), - "%qD specified both in declare target % and %" - " clauses", t); + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ENTER) + error_at (OMP_CLAUSE_LOCATION (c), + "%qD specified both in declare target % and %qs" + " clauses", t, OMP_CLAUSE_ENTER_TO (c) ? "to" : "enter"); + else + error_at (OMP_CLAUSE_LOCATION (c), + "%qD specified both in declare target % and " + "% or % clauses", t); continue; } if (!at1) --- gcc/cp/parser.cc.jj 2022-05-26 23:22:30.306850645 +0200 +++ gcc/cp/parser.cc 2022-05-27 17:31:19.086980582 +0200 @@ -45991,9 +45991,14 @@ handle_omp_declare_target_clause (tree c id = get_identifier ("omp declare target"); if (at2) { - error_at (OMP_CLAUSE_LOCATION (c), - "%qD specified both in declare target % and %" - " clauses", t); + if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_ENTER) + error_at (OMP_CLAUSE_LOCATION (c), + "%qD specified both in declare target % and %qs" + " clauses", t, OMP_CLAUSE_ENTER_TO (c) ? "to" : "enter"); + else + error_at (OMP_CLAUSE_LOCATION (c), + "%qD specified both in declare target % and " + "% or % clauses", t); return false; } if (!at1) --- gcc/testsuite/c-c++-common/gomp/declare-target-2.c.jj 2022-05-27 12:31:36.114087022 +0200 +++ gcc/testsuite/c-c++-common/gomp/declare-target-2.c 2022-05-27 17:38:12.173731493 +0200 @@ -10,7 +10,22 @@ int b; #pragma omp declare target enter (b) link (b) /* { dg-error "appears more than once on the same .declare target. directive" } */ int c; #pragma omp declare target (c) -#pragma omp declare target link (c) /* { dg-error "specified both in declare target" } */ +#pragma omp declare target link (c) /* { dg-error "specified both in declare target 'link' and 'to' or 'enter' clauses" } */ +int c2; +#pragma omp declare target to (c2) +#pragma omp declare target link (c2) /* { dg-error "specified both in declare target 'link' and 'to' or 'enter' clauses" } */ +int c3; +#pragma omp declare target enter (c3) +#pragma omp declare target link (c3) /* { dg-error "specified both in declare target 'link' and 'to' or 'enter' clauses" } */ +int c4; +#pragma omp declare target link (c4) +#pragma omp declare target (c4) /* { dg-error "specified both in declare target 'link' and 'enter' clauses" } */ +int c5; +#pragma omp declare target link (c5) +#pragma omp declare target to (c5) /* { dg-error "specified both in declare target 'link' and 'to' clauses" } */ +int c6; +#pragma omp declare target link (c6) +#pragma omp declare target enter (c6) /* { dg-error "specified both in declare target 'link' and 'enter' clauses" } */ int foo (void); #pragma omp declare target link (foo) /* { dg-error "is not a variable in clause" } */ struct S; Jakub