From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D7EF53858C83; Wed, 28 Sep 2022 12:53:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D7EF53858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664369589; bh=oIxofa4d0k/O8hbhCQTWx+YnWhtibcxqCX8GXoeZ6Ws=; h=From:To:Subject:Date:From; b=CunNZjYfwQkPGvctRm6Xmt8d3J1eysh3yNkHKB2Iq8cSygxa9/IFbKwCLk6I6P10j mcQT/l8Wl7pUMez/QgWm5IHPFchpMku9IayZRKZ/jtQ6zl1zGzOJCf0oXM5KoeDyrv pFeMfRIf8wJuUWoHd4rj94giMBYoQxEy9iak4jtM= From: "parras at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: openmp X-Bugzilla-Severity: normal X-Bugzilla-Who: parras at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter cc target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107067 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=3D53636&action=3Dedit 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 =3D { 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 =20=20=20=20=20=20=20 /scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/parse.cc:5895 0x6d6d6f parse_executable =20=20=20=20=20=20=20 /scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/parse.cc:6051 0x7dafb0 parse_progunit =20=20=20=20=20=20=20 /scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/parse.cc:6349 0x7dc670 gfc_parse_file() =20=20=20=20=20=20=20 /scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/parse.cc:6872 0x835acf gfc_be_parse_file =20=20=20=20=20=20=20 /scratch/pauarr3t/build_17657/src/gcc-og12-branch/gcc/fortran/f95-lang.cc:2= 24 ``` On the other hand, if `call bar()` comes before the block, it is parsed correctly.=