From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4CE623857802; Mon, 22 Feb 2021 18:17:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4CE623857802 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99138] ICE in gfc_match_rvalue, at fortran/primary.c:3738 Date: Mon, 22 Feb 2021 18:17:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: ice-on-invalid-code, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW 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: Message-ID: In-Reply-To: References: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2021 18:17:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99138 --- Comment #4 from Tobias Burnus --- (In reply to Paul Thomas from comment #3) > Is the problem not that the parser is not picking up the incorrectly plac= ed > print statement? It should never be passed to the matcher because it is in > the contains context. Ups. I mess up my visual parser ... =E2=80=93 Yes, I concur that rvalue mat= ching should not happen (only some 'end' =E2=80=93 or 'subroutine'/'[type-spec|(im)pure|= ...] function' is permitted =E2=80=93 unless it is 'type; ...; contains' which h= as some other permitted values or ... The current code has: parse_contained() st =3D next_statement (); switch (st) { case ST_NONE: case ST_FUNCTION: case ST_SUBROUTINE: case ST_END_FUNCTION: case ST_END_MODULE: case ST_END_SUBMODULE: case ST_END_PROGRAM: case ST_END_SUBROUTINE: ... default: gfc_error ("Unexpected %s statement in CONTAINS section at %C", gfc_ascii_statement (st)); It sounds as if you want to have something which only tries to match those = =E2=80=93 and then simply stops with an error at the the end, pointing to the line without trying to parse it. =E2=80=94 That would avoid a lot of 'gfc_error'= which are silenced and speeds up parsing (not that it is really the bottle neck).=