From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102389 invoked by alias); 8 Jun 2015 14:59:43 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 102370 invoked by uid 89); 8 Jun 2015 14:59:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 08 Jun 2015 14:59:40 +0000 Received: from svr-orw-fem-06.mgc.mentorg.com ([147.34.97.120]) by relay1.mentorg.com with esmtp id 1Z1yWR-0001Ic-1U from Cesar_Philippidis@mentor.com ; Mon, 08 Jun 2015 07:59:31 -0700 Received: from [127.0.0.1] (147.34.91.1) by SVR-ORW-FEM-06.mgc.mentorg.com (147.34.97.120) with Microsoft SMTP Server id 14.3.224.2; Mon, 8 Jun 2015 07:59:30 -0700 Message-ID: <5575ADD2.8030007@codesourcery.com> Date: Mon, 08 Jun 2015 14:59:00 -0000 From: Cesar Philippidis User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Ilmir Usmanov CC: "gcc-patches@gcc.gnu.org" , =?UTF-8?B?0JjQu9GM?= =?UTF-8?B?0LzQuNGAINCj0YHQvNCw0L3QvtCy?= , Subject: Re: [gomp4, fortran] Patch to fix continuation checks of OpenACC and OpenMP directives References: <6770611433710899@web6g.yandex.ru> <6776171433711155@web6g.yandex.ru> In-Reply-To: <6776171433711155@web6g.yandex.ru> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-06/txt/msg00033.txt.bz2 On 06/07/2015 02:05 PM, Ilmir Usmanov wrote: > Fixed fortran mail-list address. Sorry for inconvenience. > > 08.06.2015, 00:01, "Ilmir Usmanov" : >>> Hi Cesar! >>> >>> This patch fixes checks of OpenMP and OpenACC continuations in >>> case if someone mixes them (i.e. continues OpenMP directive with >>> !$ACC sentinel or vice versa). >>> >>> OK for gomp branch? Thanks for working on this. Does this fix PR63858 by any chance? two minor nits... > 0001-Fix-mix-of-OpenACC-and-OpenMP-sentinels-in-continuat.patch > > > From 5492bf5bc991b6924f5e3b35c11eeaed745df073 Mon Sep 17 00:00:00 2001 > From: Ilmir Usmanov > Date: Sun, 7 Jun 2015 23:55:22 +0300 > Subject: [PATCH] Fix mix of OpenACC and OpenMP sentinels in continuation > > --- > gcc/fortran/ChangeLog | 5 +++++ Use ChangeLog.gomp for gomp-4_0-branch. > gcc/fortran/scanner.c | 28 ++++++++++++++++++++++++---- > gcc/testsuite/ChangeLog | 5 +++++ > gcc/testsuite/gfortran.dg/goacc/omp.f95 | 8 ++++++++ > 4 files changed, 42 insertions(+), 4 deletions(-) > > diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog > index 67f9e09..f61e0e9 100644 > --- a/gcc/fortran/ChangeLog > +++ b/gcc/fortran/ChangeLog > @@ -1,3 +1,8 @@ > +2015-06-07 Ilmir Usmanov > + > + * scanner.c (gfc_next_char_literal): Fix mix of OpenACC and OpenMP > + sentinels in continuation. > + > 2015-05-05 David Malcolm > > * expr.c (check_inquiry): Fix indentation so that it reflects the > diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c > index f0e6404..5af4eea 100644 > --- a/gcc/fortran/scanner.c > +++ b/gcc/fortran/scanner.c > @@ -1331,7 +1331,7 @@ restart: > continue_line = gfc_linebuf_linenum (gfc_current_locus.lb); > > if (flag_openmp) > - if (prev_openmp_flag != openmp_flag) > + if (prev_openmp_flag != openmp_flag && !openacc_flag) > { > gfc_current_locus = old_loc; > openmp_flag = prev_openmp_flag; > @@ -1340,7 +1340,7 @@ restart: > } > > if (flag_openacc) > - if (prev_openacc_flag != openacc_flag) > + if (prev_openacc_flag != openacc_flag && !openmp_flag) > { > gfc_current_locus = old_loc; > openacc_flag = prev_openacc_flag; > @@ -1359,7 +1359,7 @@ restart: > while (gfc_is_whitespace (c)) > c = next_char (); > > - if (openmp_flag) > + if (openmp_flag && !openacc_flag) > { > for (i = 0; i < 5; i++, c = next_char ()) > { > @@ -1370,7 +1370,7 @@ restart: > while (gfc_is_whitespace (c)) > c = next_char (); > } > - if (openacc_flag) > + if (openacc_flag && !openmp_flag) > { > for (i = 0; i < 5; i++, c = next_char ()) > { > @@ -1382,6 +1382,26 @@ restart: > c = next_char (); > } > > + /* In case we have an OpenMP directive continued by OpenACC > + sentinel, or vice versa, we get both openmp_flag and > + openacc_flag on. */ > + > + if (openacc_flag && openmp_flag) > + { > + int is_openmp = 0; > + for (i = 0; i < 5; i++, c = next_char ()) > + { > + if (gfc_wide_tolower (c) != (unsigned char) "!$acc"[i]) > + is_openmp = 1; > + if (i == 4) > + old_loc = gfc_current_locus; > + } > + gfc_error ("Wrong %s continuation at %C: expected %s, got %s", > + is_openmp ? "OpenACC" : "OpenMP", > + is_openmp ? "!$ACC" : "!$OMP", > + is_openmp ? "!$OMP" : "!$ACC"); I think it's better for the translation project if you made this a complete string. So maybe change this line into gfc_error (is_openmp ? "Wrong continuation at %C: expected !$ACC, got" " !$OMP", : "Wrong continuation at %C: expected !$OMP, got !$ACC"); Other than that, it looks fine. Thanks, Cesar