https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99711
--- Comment #5 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Tue, Mar 23, 2021 at 02:41:27AM +0000, jvdelisle at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99711 > > --- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- > Setting the character length in the type spec enables this to run correctly, > so > the string length is not getting set correctly in the allocate statement. > > program allocnml > implicit none > > character(len=10), dimension(:), allocatable :: cbulist_ru ! set here > integer :: iluseg > > namelist /nam_bu_ru/ cbulist_ru > > allocate( character(len=10) :: cbulist_ru(5) ) > > open(newunit=iluseg, file='list.nml', status='old', & > action='read', form='formatted', access='sequential') > > read(unit=iluseg, nml=nam_bu_ru) > > print *, cbulist_ru > I don't use namelist, so will defer to you on the details. I input file only defines cbulist_ru(1) through cbulist_ru(4), so the namelist initializes only an array section. If that is conforming, then technically the print statement is invalid, because cbulist_ru(5) is uninitialized.