http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51055
--- Comment #2 from jpr at csc dot fi 2011-11-10 06:09:07 UTC --- OK, i found and lost the PR that included this. However, your workaround doesn't seem to work either: program a character(len=:),allocatable::s integer::j=2 s=repeat(' ',j) print*,len(s),len(repeat(' ',j)) end program a gfortran -o a a.f90; ./a 2846708 2