public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-2992] Fortran: Add OpenMP's nothing directive support Date: Wed, 18 Aug 2021 13:24:38 +0000 (GMT) [thread overview] Message-ID: <20210818132438.A6514385C419@sourceware.org> (raw) https://gcc.gnu.org/g:f74433e70ae94a3b5291e45fea488b1cfdee4a34 commit r12-2992-gf74433e70ae94a3b5291e45fea488b1cfdee4a34 Author: Tobias Burnus <tobias@codesourcery.com> Date: Wed Aug 18 15:21:18 2021 +0200 Fortran: Add OpenMP's nothing directive support Fortran version of commit 5079b7781a2c506dcdfb241347d74c7891268225 gcc/fortran/ChangeLog: * match.h (gfc_match_omp_nothing): New. * openmp.c (gfc_match_omp_nothing): New. * parse.c (decode_omp_directive): Match 'nothing' directive. gcc/testsuite/ChangeLog: * gfortran.dg/nothing-1.f90: New test. * gfortran.dg/nothing-2.f90: New test. Diff: --- gcc/fortran/match.h | 1 + gcc/fortran/openmp.c | 11 +++++++++++ gcc/fortran/parse.c | 3 +++ gcc/testsuite/gfortran.dg/nothing-1.f90 | 28 ++++++++++++++++++++++++++++ gcc/testsuite/gfortran.dg/nothing-2.f90 | 7 +++++++ 5 files changed, 50 insertions(+) diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index aac16a8d3d0..5127b4b8ea3 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -175,6 +175,7 @@ match gfc_match_omp_masked_taskloop_simd (void); match gfc_match_omp_master (void); match gfc_match_omp_master_taskloop (void); match gfc_match_omp_master_taskloop_simd (void); +match gfc_match_omp_nothing (void); match gfc_match_omp_ordered (void); match gfc_match_omp_ordered_depend (void); match gfc_match_omp_parallel (void); diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 9675b658409..fd219dc9c4d 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -4797,6 +4797,17 @@ gfc_match_omp_ordered (void) return match_omp (EXEC_OMP_ORDERED, OMP_ORDERED_CLAUSES); } +match +gfc_match_omp_nothing (void) +{ + if (gfc_match_omp_eos () != MATCH_YES) + { + gfc_error ("Unexpected junk after $OMP NOTHING statement at %C"); + return MATCH_ERROR; + } + /* Will use ST_NONE; therefore, no EXEC_OMP_ is needed. */ + return MATCH_YES; +} match gfc_match_omp_ordered_depend (void) diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 24cc9bfb9f1..d004732677c 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -1005,6 +1005,9 @@ decode_omp_directive (void) ST_OMP_MASTER_TASKLOOP); matcho ("master", gfc_match_omp_master, ST_OMP_MASTER); break; + case 'n': + matcho ("nothing", gfc_match_omp_nothing, ST_NONE); + break; case 'l': matcho ("loop", gfc_match_omp_loop, ST_OMP_LOOP); break; diff --git a/gcc/testsuite/gfortran.dg/nothing-1.f90 b/gcc/testsuite/gfortran.dg/nothing-1.f90 new file mode 100644 index 00000000000..9fc24d4bd6c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nothing-1.f90 @@ -0,0 +1,28 @@ +module m + implicit none (type, external) + !$omp nothing + + type t + !$omp nothing + integer s + end type + +contains + +integer function foo (i) + integer :: i + + !$omp nothing + if (.false.) & +& & !$omp nothing + i = i + 1 + +! In the following, '& & !$' is not a valid OpenMP sentinel and, +! hence, the line is regarded as comment + if (.false.) & +& & !$omp nothing + then + end if + foo = i +end +end module diff --git a/gcc/testsuite/gfortran.dg/nothing-2.f90 b/gcc/testsuite/gfortran.dg/nothing-2.f90 new file mode 100644 index 00000000000..74a4a5a22b0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/nothing-2.f90 @@ -0,0 +1,7 @@ +pure subroutine foo + !$omp nothing ! { dg-error "OpenMP directives other than SIMD or DECLARE TARGET at .1. may not appear in PURE procedures" } +end subroutine + +subroutine bar + !$omp nothing foo ! { dg-error "Unexpected junk after $OMP NOTHING statement" } +end
reply other threads:[~2021-08-18 13:24 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210818132438.A6514385C419@sourceware.org \ --to=burnus@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).