From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11250 invoked by alias); 25 Nov 2015 19:10:37 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 11216 invoked by uid 89); 25 Nov 2015 19:10:36 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-lf0-f49.google.com Received: from mail-lf0-f49.google.com (HELO mail-lf0-f49.google.com) (209.85.215.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 25 Nov 2015 19:10:34 +0000 Received: by lfaz4 with SMTP id z4so72290208lfa.0; Wed, 25 Nov 2015 11:10:31 -0800 (PST) X-Received: by 10.112.141.201 with SMTP id rq9mr15885235lbb.4.1448478631490; Wed, 25 Nov 2015 11:10:31 -0800 (PST) Received: from [10.34.40.73] (089144200073.atnat0009.highway.a1.net. [89.144.200.73]) by smtp.gmail.com with ESMTPSA id d196sm3594244lfd.38.2015.11.25.11.10.29 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 25 Nov 2015 11:10:30 -0800 (PST) User-Agent: K-9 Mail for Android In-Reply-To: <5655C6CB.5020901@codesourcery.com> References: <3008431435623821@web14j.yandex.ru> <5591E54E.90509@ilmir.us> <5575ADD2.8030007@codesourcery.com> <87r3ntr8li.fsf@kepler.schwinge.homeip.net> <878u7cny9v.fsf@kepler.schwinge.homeip.net> <20151020093733.GV478@tucnak.redhat.com> <5655C6CB.5020901@codesourcery.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Subject: Re: [PR fortran/63858] Fix mix of OpenACC and OpenMP sentinels in continuations From: Bernhard Reutner-Fischer Date: Wed, 25 Nov 2015 19:14:00 -0000 To: Cesar Philippidis ,Jakub Jelinek ,Thomas Schwinge CC: gcc-patches@gcc.gnu.org,fortran@gcc.gnu.org,i.usmanov@samsung.com,Ilmir Usmanov Message-ID: <52FC6B7C-7AA5-4F5E-9207-BB3EBC79A350@gmail.com> X-IsSubscribed: yes X-SW-Source: 2015-11/txt/msg03137.txt.bz2 On November 25, 2015 3:33:47 PM GMT+01:00, Cesar Philippidis wrote: >On 10/20/2015 02:37 AM, Jakub Jelinek wrote: >> On Fri, Oct 09, 2015 at 12:15:24PM +0200, Thomas Schwinge wrote: >>> diff --git gcc/fortran/scanner.c gcc/fortran/scanner.c >>> index bfb7d45..1e1ea84 100644 >>> --- gcc/fortran/scanner.c >>> +++ gcc/fortran/scanner.c >>> @@ -935,6 +935,63 @@ skip_free_comments (void) >>> return false; >>> } >>> >>> +/* Return true if MP was matched in fixed form. */ >>> +static bool >>> +skip_omp_attribute_fixed (locus *start) >> >> Technically, this isn't attribute, but sentinel. >> So, skip_fixed_omp_sentinel? I know the free functions >> are called attribute, perhaps we should rename them too, >> patch to do so preapproved. > >I've renamed those functions in this patch. The free variants are named >skip_free_*_sentinel. > >>> +{ >>> + gfc_char_t c; >>> + if (((c = next_char ()) == 'm' || c == 'M') >>> + && ((c = next_char ()) == 'p' || c == 'P')) >>> + { >>> + c = next_char (); >>> + if (c != '\n' >>> + && (continue_flag >> >> The original code checked here >> (openmp_flag && continue_flag) >> instead. Is that change intentional? > >I think so. Without it, continuations won't work with -fopenmp-simd. >Note how that function call is guarded by > > if ((flag_openmp || flag_openmp_simd) && !flag_openacc) > >> Looking around, we probably don't have a testcase coverage for say >> fixed form: >> >> C*OMP+PARALLEL DO >> do ... > >That's going to be tricky. In fixed mode, the only way that we can tell >if there is an omp/acc continuation is by inspecting the character at >position 6. So, there could be a comment like > >C*ACCELERATOR > >which would get picked up as an acc continuation. > >> (i.e. where it starts with an OpenMP (or OpenACC) continuation, >without >> non-continued line first), or for free form where: >> >> something & >> !$omp & parallel >> >> (ditto for OpenACC). > >What type of error should this be reporting? Right now it does report >an >error because this gets expanded to > >something parallel > >That's clearly not correct. But at the same time, it would still be an >error if the user placed !$omp/acc between a continuation. > >>> + while (gfc_is_whitespace (c)); gfc_gobble_whitespace () ? TIA, PS: this thread has the relevant citations from the openmp standard, in case https://gcc.gnu.org/ml/fortran/2007-02/msg00312.html I didn't look to see what acc says in this regard. >>> + if (c != '\n' && c != '!') >>> + { >>> + /* Canonicalize to *$omp. */ >> >> The comment has a pasto, by storing * you canonicalize to *$acc. > >Fixed.