https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99711
--- Comment #15 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Fri, Mar 26, 2021 at 01:47:28AM +0000, jvdelisle at gcc dot gnu.org wrote: > --- Comment #12 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- > This is interesting, compiling with the -g option for debugging. > > Running a test case that is working with: > > character(len=10), dimension(:), allocatable :: cbulist_ru ! explicit char > len > > Breakpoint 1, nml_read_obj (dtp=dtp@entry=0x7fffffffd260, > nl=nl@entry=0x5184c0, offset=offset@entry=0, > pprev_nl=pprev_nl@entry=0x7fffffffd068, > nml_err_msg=nml_err_msg@entry=0x7fffffffd100 "Internal namelist read > error", clow=1, chigh=0, nml_err_msg_size=200) > at ../../../trunk/libgfortran/io/list_read.c:2886 > 2886 if (dtp->u.p.nml_read_error || !nl->touched) > (gdb) p nl > $1 = (namelist_info *) 0x5184c0 > (gdb) p *nl > $2 = {type = BT_CHARACTER, var_name = 0x518530 "cbulist_ru", > mem_pos = 0x515e80, dtio_sub = 0x0, vtable = 0x0, touched = 1, len = 1, > var_rank = 1, size = 10, string_length = 10, dim = 0x518550, ls = 0x518570, > next = 0x0} > > string_length as expected. > Hmmm. Another place that string length info is held? gfortran has ts->u.cl.length, expr->value->character->length, and now nl->string_length. Yep, I would say that the deferred length isn't being propagated into the nl struct. Probably need to check for expr->ts.type == BT_CHARACTER and expr->ts.deferred to grab the string length from the type spec.