From patchwork Fri Nov 27 17:18:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tobias Burnus X-Patchwork-Id: 1407350 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=8.43.85.97; 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 [8.43.85.97]) (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 4CjLvX5nCwz9sRR for ; Sat, 28 Nov 2020 04:19:02 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 94DCD3973064; Fri, 27 Nov 2020 17:18:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 918E43858026; Fri, 27 Nov 2020 17:18:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 918E43858026 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: xyhEg5qzGTyHNHw3M6drowr0Vl7nwlbEjzQ5IU2wTVVvILrdWpz/6yazy6E/2dxS9YwLDhxvFX w+nAQxnYRjdYktDthYmwSHs5RdpW5JN/lFcAdokOb6+QV24U2dR/ZsaOCKQawG5YAnqb/Lpxdl LEYqCokLyQHVrX1bbDB84ua+i09vd5KTrLAVR4VyGhboxrblpY13E1yrwinu2rkSUiRskKDKjc mnzaKFFqgLusTbXZN5ujGJatSysfvJY7yq+b/Y/irgswxMwSRC8Ywk3+jx6g+owb/TE46iboCt hDo= X-IronPort-AV: E=Sophos;i="5.78,375,1599552000"; d="diff'?scan'208";a="55671201" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa4.mentor.iphmx.com with ESMTP; 27 Nov 2020 09:18:52 -0800 IronPort-SDR: 8KveBqm2yZf3Sv2K4JlIMjRRFsGuQUDSOWs+OQBT1uOjQ7ov0ApKQcvWSaKbF8yQtKCaeoPLGb u4tENUmTX89r0SMtYp4kpwlqMHJ8ghYIaDk+F/zkLVrgQROOyt64GhQpT06ne5IDiUwxKgpEWr x5w1/la+sCqj+/Qai7IUbLSRkGr8wRWqwKkqpIFXYK+iZvV3CdebdMjZ55GlueT3fHkgP3EmuI kJFhPtDt7sTCLWDJzTx6cKxmGKfx+JELtxiKHqo9ewtWUo1m7+2gMZIZ5PC+tysLU7330nolKV yy0= To: gcc-patches , fortran , Thomas Schwinge From: Tobias Burnus Subject: Fortran: With OpenACC, ignore OpenMP's cond comp sentinels Message-ID: <344cae01-4b4d-1e6c-afb6-c8e869b140a2@codesourcery.com> Date: Fri, 27 Nov 2020 18:18:46 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.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-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-12.2 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" '!' starts in Fortran a comment (+ fixed-form variants) OpenACC defines as sentinel "!$acc" (likewise) But OpenMP has two: Besides "!$omp" there is additionally "!$ " (with space) to permit conditional compilation. Currently, -fopenacc also executes the '!$ ' code, which I think does not make sense. Hence, this patch ignores it. Comments? If not, I intent to commit it in the next days Tobias ----------------- Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander Walter Fortran: With OpenACC, ignore OpenMP's cond comp sentinels gcc/fortran/ChangeLog: PR fortran/98011 * scanner.c (skip_free_comments): If only -fopenacc but not -fopenmp is used, ignore OpenMP's conditional compilation sentinels. gcc/testsuite/ChangeLog: PR fortran/98011 * gfortran.dg/goacc/sentinel-free-form.f95: Update as OpenMP's "!$ " conditional compilation sentinels are now ignored. gcc/fortran/scanner.c | 23 ++++++++-------------- .../gfortran.dg/goacc/sentinel-free-form.f95 | 7 +++++-- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index fd11f5a244a..b70728d6bd1 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -899,21 +899,14 @@ skip_free_comments (void) if (next_char () == '$') { c = next_char (); - if (c == 'a' || c == 'A') - { - if (skip_free_oacc_sentinel (start, old_loc)) - return false; - gfc_current_locus = old_loc; - next_char(); - c = next_char(); - } - if (continue_flag || c == ' ' || c == '\t') - { - gfc_current_locus = old_loc; - next_char(); - openacc_flag = 0; - return true; - } + if (c == 'a' || c == 'A') + { + if (skip_free_oacc_sentinel (start, old_loc)) + return false; + gfc_current_locus = old_loc; + next_char(); + c = next_char(); + } } gfc_current_locus = old_loc; } diff --git a/gcc/testsuite/gfortran.dg/goacc/sentinel-free-form.f95 b/gcc/testsuite/gfortran.dg/goacc/sentinel-free-form.f95 index 1a3189cb34e..00dac667ef1 100644 --- a/gcc/testsuite/gfortran.dg/goacc/sentinel-free-form.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/sentinel-free-form.f95 @@ -10,7 +10,10 @@ program test x = 0.0 !$acc parallel ! comment ! sentinel must appear as a single word ! $acc parallel ! comment - !$ acc parallel ! { dg-error "Unclassifiable statement" } + + ! note that '!$ ' is OpenMP's conditional compilation sentinel + !$ acc ignored_due_to_space ! comment + ! directive lines must have space after sentinel !$accparallel ! { dg-warning "followed by a space" } do i = 1,10