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-8730] Fortran/OpenMP: Fix strictly structured blocks parsing Date: Tue, 30 Aug 2022 17:38:08 +0000 (GMT) [thread overview] Message-ID: <20220830173808.972C1385841A@sourceware.org> (raw) https://gcc.gnu.org/g:bd2bc5f78d5a423a6e0537748b01ca45edbc75e5 commit r12-8730-gbd2bc5f78d5a423a6e0537748b01ca45edbc75e5 Author: Tobias Burnus <tobias@codesourcery.com> Date: Thu Aug 25 08:34:03 2022 +0200 Fortran/OpenMP: Fix strictly structured blocks parsing gcc/fortran/ChangeLog: * parse.cc (parse_omp_structured_block): When parsing strictly structured blocks, issue an error if the end-directive comes before the 'end block'. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/strictly-structured-block-4.f90: New test. (cherry picked from commit 33f24eb58748e9db7c827662753757c5c2217eb4) Diff: --- gcc/fortran/parse.cc | 2 +- .../gomp/strictly-structured-block-4.f90 | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/parse.cc b/gcc/fortran/parse.cc index e6e915d2a5e..d1c72ef92e7 100644 --- a/gcc/fortran/parse.cc +++ b/gcc/fortran/parse.cc @@ -5708,7 +5708,7 @@ parse_omp_structured_block (gfc_statement omp_st, bool workshare_stmts_only) } return st; } - else if (st != omp_end_st) + else if (st != omp_end_st || block_construct) { unexpected_statement (st); st = next_statement (); diff --git a/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-4.f90 b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-4.f90 new file mode 100644 index 00000000000..66cf0a3925e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/strictly-structured-block-4.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } +implicit none +integer ::x,z +x = 42 +print '(*(z16:" "))', loc(x) +!$omp target map(x, z) +block + integer :: y + x = 123 + y = 99 + !$omp target device(ancestor:1) map(always,tofrom:x) map(y) ! { dg-error "'ancestor' device modifier not preceded by 'requires' directive with 'reverse_offload' clause" } + print '(*(z16:" "))', loc(x), loc(y) + print * ,x, y + x = -x + y = -y + !$omp end target ! { dg-error "Unexpected ..OMP END TARGET statement" } + z = y +end block + print * ,x !, z +end +
reply other threads:[~2022-08-30 17:38 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=20220830173808.972C1385841A@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).