https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86033
Bug ID: 86033 Summary: Automated reallocation of empty string array fails with -fcheck=all Product: gcc Version: 8.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: m.diehl at mpie dot de Target Milestone: --- The following code fails at runtime with > Fortran runtime error: Different CHARACTER lengths (0/64) in array constructor if I compile with > -fcheck=all in addition to > gfortran -std=f2008ts program test implicit none character(len=64), dimension(:), allocatable :: str64Array character(len=64) :: str64 allocate(str64Array(0),source=str64) ! empty array write(6,*) size(str64Array); flush(6) ! gives 0 write(6,*) len(str64Array(0)); flush(6) ! gives 64 str64 ='a' str64Array = [str64Array,str64] ! causes error with -fcheck=all write(6,*) size(str64Array); flush(6) ! gives 1 if compiled without -fcheck=all write(6,*) len(str64Array(1)); flush(6) ! gives 64 if compiled without -fcheck=all str64 ='b' str64Array = [str64Array,str64] write(6,*) size(str64Array); flush(6) ! gives 2 if compiled without -fcheck=all write(6,*) len(str64Array(1)); flush(6) ! gives 64 if compiled without -fcheck=all write(6,*) len(str64Array(2)); flush(6) ! gives 64 if compiled without -fcheck=all write(6,*) str64Array(1); flush(6) ! gives a if compiled without -fcheck=all write(6,*) str64Array(2); flush(6) ! gives b if compiled without -fcheck=all end program