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 70254385840A for ; Thu, 11 Nov 2021 18:01:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 70254385840A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-258-JTZwb_7BPDqgJnot6Nuksw-1; Thu, 11 Nov 2021 13:01:20 -0500 X-MC-Unique: JTZwb_7BPDqgJnot6Nuksw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D24F1871805; Thu, 11 Nov 2021 18:01:18 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C10960854; Thu, 11 Nov 2021 18:01:18 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.16.1/8.16.1) with ESMTPS id 1ABI1F6R2421159 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 11 Nov 2021 19:01:16 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.16.1/8.16.1/Submit) id 1ABI1Evs2421158; Thu, 11 Nov 2021 19:01:14 +0100 Date: Thu, 11 Nov 2021 19:01:14 +0100 From: Jakub Jelinek To: Tobias Burnus Cc: gcc-patches , fortran Subject: Re: [Patch] Fortran/openmp: Fix '!$omp end' Message-ID: <20211111180114.GU2710@tucnak> Reply-To: Jakub Jelinek References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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=-5.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, 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: , X-List-Received-Date: Thu, 11 Nov 2021 18:01:25 -0000 On Thu, Nov 11, 2021 at 06:11:23PM +0100, Tobias Burnus wrote: > --- a/gcc/fortran/parse.c > +++ b/gcc/fortran/parse.c > @@ -915,15 +915,16 @@ decode_omp_directive (void) > matcho ("error", gfc_match_omp_error, ST_OMP_ERROR); > matcho ("end atomic", gfc_match_omp_eos_error, ST_OMP_END_ATOMIC); > matcho ("end critical", gfc_match_omp_end_critical, ST_OMP_END_CRITICAL); > - matchs ("end distribute parallel do simd", gfc_match_omp_eos_error, > + matchs ("end distribute parallel do simd", gfc_match_omp_end_nowait, > ST_OMP_END_DISTRIBUTE_PARALLEL_DO_SIMD); > - matcho ("end distribute parallel do", gfc_match_omp_eos_error, > + matcho ("end distribute parallel do", gfc_match_omp_end_nowait, I think the above two changes are incorrect. At least looking at 5.1 which is clearer than 5.2, 5.1 [221:17-23] says for C/C++ that while nowait is allowed on worksharing-loop, it is not allowed on combined parallel worksharing-loop, and Fortran has that restriction through the syntax (no [nowait] on !$omp end parallel do). > @@ -936,9 +937,12 @@ decode_omp_directive (void) > ST_OMP_END_MASTER_TASKLOOP); > matcho ("end master", gfc_match_omp_eos_error, ST_OMP_END_MASTER); > matchs ("end ordered", gfc_match_omp_eos_error, ST_OMP_END_ORDERED); > - matchs ("end parallel do simd", gfc_match_omp_eos_error, > + matchs ("end parallel do simd", gfc_match_omp_end_nowait, > ST_OMP_END_PARALLEL_DO_SIMD); > - matcho ("end parallel do", gfc_match_omp_eos_error, ST_OMP_END_PARALLEL_DO); > + matcho ("end parallel do", gfc_match_omp_end_nowait, > + ST_OMP_END_PARALLEL_DO); Likewise for the above two. > @@ -951,46 +955,53 @@ decode_omp_directive (void) > ST_OMP_END_PARALLEL_MASTER_TASKLOOP); > matcho ("end parallel master", gfc_match_omp_eos_error, > ST_OMP_END_PARALLEL_MASTER); > - matcho ("end parallel sections", gfc_match_omp_eos_error, > + matcho ("end parallel sections", gfc_match_omp_end_nowait, > ST_OMP_END_PARALLEL_SECTIONS); > - matcho ("end parallel workshare", gfc_match_omp_eos_error, > + matcho ("end parallel workshare", gfc_match_omp_end_nowait, > ST_OMP_END_PARALLEL_WORKSHARE); Ditto for the above two. > matcho ("end parallel", gfc_match_omp_eos_error, ST_OMP_END_PARALLEL); > matcho ("end scope", gfc_match_omp_end_nowait, ST_OMP_END_SCOPE); > matcho ("end sections", gfc_match_omp_end_nowait, ST_OMP_END_SECTIONS); > matcho ("end single", gfc_match_omp_end_single, ST_OMP_END_SINGLE); > matcho ("end target data", gfc_match_omp_eos_error, ST_OMP_END_TARGET_DATA); > - matchs ("end target parallel do simd", gfc_match_omp_eos_error, > + matchs ("end target parallel do simd", gfc_match_omp_end_nowait, The above seems like a bug in 5.1 standard, haven't checked 5.2. !$omp end target parallel do simd nowait should be IMO valid, but [241:16] mistakenly doesn't list it. > ST_OMP_END_TARGET_PARALLEL_DO_SIMD); > - matcho ("end target parallel do", gfc_match_omp_eos_error, > + matcho ("end target parallel do", gfc_match_omp_end_nowait, Similarly. > ST_OMP_END_TARGET_PARALLEL_DO); > - matcho ("end target parallel", gfc_match_omp_eos_error, > + matcho ("end target parallel loop", gfc_match_omp_end_nowait, > + ST_OMP_END_TARGET_PARALLEL_LOOP); Similarly. > + matcho ("end target parallel", gfc_match_omp_end_nowait, > ST_OMP_END_TARGET_PARALLEL); Similarly. > - matchs ("end target simd", gfc_match_omp_eos_error, ST_OMP_END_TARGET_SIMD); > + matchs ("end target simd", gfc_match_omp_end_nowait, ST_OMP_END_TARGET_SIMD); Similarly. > matchs ("end target teams distribute parallel do simd", > - gfc_match_omp_eos_error, > + gfc_match_omp_end_nowait, > ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD); > - matcho ("end target teams distribute parallel do", gfc_match_omp_eos_error, > + matcho ("end target teams distribute parallel do", > + gfc_match_omp_end_nowait, > ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO); > - matchs ("end target teams distribute simd", gfc_match_omp_eos_error, > + matchs ("end target teams distribute simd", gfc_match_omp_end_nowait, > ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_SIMD); > - matcho ("end target teams distribute", gfc_match_omp_eos_error, > + matcho ("end target teams distribute", gfc_match_omp_end_nowait, > ST_OMP_END_TARGET_TEAMS_DISTRIBUTE); > - matcho ("end target teams", gfc_match_omp_eos_error, ST_OMP_END_TARGET_TEAMS); > - matcho ("end target", gfc_match_omp_eos_error, ST_OMP_END_TARGET); > + matcho ("end target teams loop", gfc_match_omp_end_nowait, > + ST_OMP_END_TARGET_TEAMS_LOOP); > + matcho ("end target teams", gfc_match_omp_end_nowait, > + ST_OMP_END_TARGET_TEAMS); > + matcho ("end target", gfc_match_omp_end_nowait, ST_OMP_END_TARGET); Similarly all the above. !$omp end target followed by anything should accept nowait. > matcho ("end taskgroup", gfc_match_omp_eos_error, ST_OMP_END_TASKGROUP); > matchs ("end taskloop simd", gfc_match_omp_eos_error, > ST_OMP_END_TASKLOOP_SIMD); > matcho ("end taskloop", gfc_match_omp_eos_error, ST_OMP_END_TASKLOOP); > matcho ("end task", gfc_match_omp_eos_error, ST_OMP_END_TASK); > - matchs ("end teams distribute parallel do simd", gfc_match_omp_eos_error, > + matchs ("end teams distribute parallel do simd", gfc_match_omp_end_nowait, > ST_OMP_END_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD); > - matcho ("end teams distribute parallel do", gfc_match_omp_eos_error, > + matcho ("end teams distribute parallel do", gfc_match_omp_end_nowait, These again shouldn't allow nowait, the outermost leaf construct that accepts nowait is do and when do is combined with parallel, nowait shouldn't be specified. Jakub