[Bug fortran/107067] New: [OpenMP] ICE with metadirective block statements

parras at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 28 12:53:09 GMT 2022


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.


More information about the Gcc-bugs mailing list