From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 91A9A3858028; Fri, 26 Mar 2021 01:47:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 91A9A3858028 From: "jvdelisle at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/99711] Crash when reading an allocated character array in namelist Date: Fri, 26 Mar 2021 01:47:28 +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: 10.2.0 X-Bugzilla-Keywords: 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: 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: Fri, 26 Mar 2021 01:47:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99711 --- Comment #12 from Jerry DeLisle --- This is interesting, compiling with the -g option for debugging. Running a test case that is working with: character(len=3D10), dimension(:), allocatable :: cbulist_ru ! explicit c= har len Breakpoint 1, nml_read_obj (dtp=3Ddtp@entry=3D0x7fffffffd260,=20 nl=3Dnl@entry=3D0x5184c0, offset=3Doffset@entry=3D0,=20 pprev_nl=3Dpprev_nl@entry=3D0x7fffffffd068,=20 nml_err_msg=3Dnml_err_msg@entry=3D0x7fffffffd100 "Internal namelist read error", clow=3D1, chigh=3D0, nml_err_msg_size=3D200) at ../../../trunk/libgfortran/io/list_read.c:2886 2886 if (dtp->u.p.nml_read_error || !nl->touched) (gdb) p nl $1 =3D (namelist_info *) 0x5184c0 (gdb) p *nl $2 =3D {type =3D BT_CHARACTER, var_name =3D 0x518530 "cbulist_ru",=20 mem_pos =3D 0x515e80, dtio_sub =3D 0x0, vtable =3D 0x0, touched =3D 1, le= n =3D 1,=20 var_rank =3D 1, size =3D 10, string_length =3D 10, dim =3D 0x518550, ls = =3D 0x518570,=20 next =3D 0x0} string_length as expected. Running the failing test case with: character(len=3D:), dimension(:), allocatable :: cbulist_ru ! deferred len Breakpoint 1, nml_read_obj (dtp=3Ddtp@entry=3D0x7fffffffd240,=20 nl=3Dnl@entry=3D0x5184c0, offset=3Doffset@entry=3D0,=20 pprev_nl=3Dpprev_nl@entry=3D0x7fffffffd048,=20 nml_err_msg=3Dnml_err_msg@entry=3D0x7fffffffd0e0 "Internal namelist read error", clow=3D1, chigh=3D0, nml_err_msg_size=3D200) at ../../../trunk/libgfortran/io/list_read.c:2886 2886 if (dtp->u.p.nml_read_error || !nl->touched) (gdb) p nl->string_length=20 $13 =3D 10 (gdb) p *nl $14 =3D {type =3D BT_CHARACTER, var_name =3D 0x518530 "cbulist_ru",=20 mem_pos =3D 0x515e80, dtio_sub =3D 0x0, vtable =3D 0x0, touched =3D 1, le= n =3D 1,=20 var_rank =3D 1, size =3D 967676983855022080, string_length =3D 10, dim = =3D 0x518550,=20 ls =3D 0x518570, next =3D 0x0} (gdb) p *nl->dim $15 =3D {_stride =3D 1, lower_bound =3D 1, _ubound =3D 5} size is messed up badly.=