From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 75D5C3858C5E; Wed, 17 May 2023 19:46:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 75D5C3858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684352781; bh=NQFCa9JgUYmHcCBb6jf9aNCZ6LblOBrGJdZX7pb/v38=; h=From:To:Subject:Date:From; b=xLjUpawvrGEKVl2Zc/uAuhbPdRI2FQeUzrJxZ2+HLUjZvYC4J47eS0Zql/x3NaBUf U7tYJJGFgIopajsaO0ffMtawwJ45hvaTnihJ2N8LNyyiPiNcmgUDyOCNHhN2XV12GJ N7CSlY1zJO/XLWQR+DjLfmC+fcUJVlp+NGmZCsTU= From: "W.H.Ball at bham dot ac.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/109897] New: Incorrect bad namelist object reported in error message when bad data appears after a valid array component Date: Wed, 17 May 2023 19:46:21 +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: og12 (devel/omp/gcc-12) X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: W.H.Ball at bham dot ac.uk 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 bug_severity priority component assigned_to reporter target_milestone 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=3D109897 Bug ID: 109897 Summary: Incorrect bad namelist object reported in error message when bad data appears after a valid array component Product: gcc Version: og12 (devel/omp/gcc-12) Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: W.H.Ball at bham dot ac.uk Target Milestone: --- Hi, A user on a Fortran project was confused by the error message they received when they provided incorrect parameters in a Fortran namelist. To reproduce= , I created this small program: $ cat bna.f90 program bna implicit none integer :: iounit, array(3) namelist /test/ array open(newunit=3Diounit, file=3D'test.nml', status=3D'old') read(iounit, nml=3Dtest) close(iounit) end program bna with this associated namlist `test.nml`: $ cat test.nml &test array(1) =3D 2 bad_namelist =3D 3 / Compiling (with default options) and running leads to this error message: $ ./bna.x At line 10 of file bna.f90 Fortran runtime error: Bad data for namelist object array <...backtrace...> This also happens if I set the value for `array(2)` instead of `array(1)` b= ut works correctly if I set the value for `array(3)`, which is conspicuously t= he last element: $ cat test.nml &test array(3) =3D 2 bad_namelist =3D 3 / $ ./bna.x At line 10 of file bna.f90 Fortran runtime error: Cannot match namelist object name bad_namelist This isn't a major issue but it would help if, in the first case, the error message would correctly identify `bad_namelist` as being the invalid parame= ter. I'm personally using gcc 12.3.1 on Fedora 37 but it was reported from and separately reproduced on other systems (whose details I don't know). I sear= ched the list of known bugs for "namelist" in the Fortran component but didn't c= ome across anything that looked specifically like this bug. Cheers, Warrick=