From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E63803857702; Sat, 17 Feb 2024 00:26:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E63803857702 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708129606; bh=A4WImgMR+WdsqQIlMvxBHjnRkW6Ud7FME4y1NH4aOY4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=emLfd5IGoPajJ82YS9FeNR2rnB4rzF3gj4VNFlfsWOq+FQ5upBKjG4Upu8pHbnGQ0 YF0dbsL4tlHZ5K0zo9UyBesoxC2mtnYjfw1sRnuUO0vceD2SO6rJFwMzJJywqYp1p/ aM0fROmKF0jnfjGD+sSwg076nK+dcO9eWjVlG41o= From: "jvdelisle at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/107068] Run-time error when reading logical arrays with a namelist Date: Sat, 17 Feb 2024 00:26:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jvdelisle at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jvdelisle 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107068 --- Comment #8 from Jerry DeLisle --- After a bit of sleuthing it turns out that the '(' in the name was being ignored and the comma in '(1,2)' was being treated as a delimiter. Since t= he following '=3D' was not seen yet, the 2 was seen as a repeat value and we g= et the error. This is fixed with the following patch: diff --git a/libgfortran/io/list_read.c b/libgfortran/io/list_read.c index f8ca64422de..0b7884fdda7 100644 --- a/libgfortran/io/list_read.c +++ b/libgfortran/io/list_read.c @@ -888,6 +888,14 @@ read_logical (st_parameter_dt *dtp, int length) for(i =3D 0; i < 63; i++) { c =3D next_char (dtp); + if (c =3D=3D '(') + { + l_push_char (dtp, c); + dtp->u.p.nml_read_error =3D 1; + dtp->u.p.line_buffer_enabled =3D 1; + dtp->u.p.line_buffer_pos =3D 0; + return; + } if (is_separator(c)) { /* All done if this is not a namelist read. */=