https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85581
Bug ID: 85581 Summary: implied DO not initializing array as expected Product: gcc Version: 6.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: urbanjost at comcast dot net Target Milestone: --- I expect the two functions to be equivalent, but returnarrB acts like (char(64+isize),I=1,isize) instead of (char(64+i),I=1,isize) was specified??? program uuidgen implicit none character(len=:),allocatable :: methods(:) methods=[returnarrA(26),returnarrA(5)] write(*,'(*("[",a,"]":,","))')methods methods=[returnarrB(26),returnarrB(5)] write(*,'(*("[",a,"]":,","))')methods contains function returnarrA(isize) result(arr) integer,intent(in) :: isize character(len=1),allocatable :: arr(:) !<== len=1 integer :: i arr=[character(len=1) ::(char(64+i),i=1,isize)] end function returnarrA function returnarrB(isize) result(arr) integer,intent(in) :: isize character(len=:),allocatable :: arr(:) !<== len=: integer :: i arr=[character(len=1) ::(char(64+i),i=1,isize)] end function returnarrB end program uuidgen Output [A],[B],[C],[D],[E],[F],[G],[H],[I],[J],[K],[L],[M],[N],[O],[P],[Q],[R],[S],[T],[U],[V],[W],[X],[Y],[Z],[A],[B],[C],[D],[E] [Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[Z],[E],[E],[E],[E],[E] Expecting returnarrA() and returnarrB() functions to return the same results. That is, I expect [A],[B],[C],[D],[E],[F],[G],[H],[I],[J],[K],[L],[M],[N],[O],[P],[Q],[R],[S],[T],[U],[V],[W],[X],[Y],[Z],[A],[B],[C],[D],[E] [A],[B],[C],[D],[E],[F],[G],[H],[I],[J],[K],[L],[M],[N],[O],[P],[Q],[R],[S],[T],[U],[V],[W],[X],[Y],[Z],[A],[B],[C],[D],[E] ~