https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99711

--- 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.

Running the failing test case with:

  character(len=:), dimension(:), allocatable :: cbulist_ru ! deferred len

Breakpoint 1, nml_read_obj (dtp=dtp@entry=0x7fffffffd240, 
    nl=nl@entry=0x5184c0, offset=offset@entry=0, 
    pprev_nl=pprev_nl@entry=0x7fffffffd048, 
    nml_err_msg=nml_err_msg@entry=0x7fffffffd0e0 "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->string_length 
$13 = 10
(gdb) p *nl
$14 = {type = BT_CHARACTER, var_name = 0x518530 "cbulist_ru", 
  mem_pos = 0x515e80, dtio_sub = 0x0, vtable = 0x0, touched = 1, len = 1, 
  var_rank = 1, size = 967676983855022080, string_length = 10, dim = 0x518550, 
  ls = 0x518570, next = 0x0}
(gdb) p *nl->dim
$15 = {_stride = 1, lower_bound = 1, _ubound = 5}


size is messed up badly.

Reply via email to