public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "parras at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/107067] New: [OpenMP] ICE with metadirective block statements
Date: Wed, 28 Sep 2022 12:53:09 +0000	[thread overview]
Message-ID: <bug-107067-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107067

            Bug ID: 107067
           Summary: [OpenMP] ICE with metadirective block statements
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: openmp
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: parras at gcc dot gnu.org
                CC: burnus at gcc dot gnu.org
  Target Milestone: ---

Created attachment 53636
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53636&action=edit
Test case triggering an ICE

The current OG12 implementation handles OMP metadirectives, but it fails to
parse the following code:

```
   !$OMP begin metadirective &
   !$OMP   when ( user = { condition ( UseDevice ) } &
   !$OMP     : nothing ) &
   !$OMP   default ( parallel )
   block
      call foo()
   end block
   call bar()
   !$omp end metadirective
```

The `call bar()` statement cannot be parsed properly as the parser expects the
`end block` to be immediately followed by `!$omp end metadirective`:

```
f951: internal compiler error: in parse_omp_metadirective_body, at
fortran/parse.cc:5895
0x6d6d6f parse_omp_metadirective_body
       
/scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/parse.cc:5895
0x6d6d6f parse_executable
       
/scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/parse.cc:6051
0x7dafb0 parse_progunit
       
/scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/parse.cc:6349
0x7dc670 gfc_parse_file()
       
/scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/parse.cc:6872
0x835acf gfc_be_parse_file
       
/scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/f95-lang.cc:224
```

On the other hand, if `call bar()` comes before the block, it is parsed
correctly.

                 reply	other threads:[~2022-09-28 12:53 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=bug-107067-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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: link
Be 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).