Created attachment 53636 [details] 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.