http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170
--- Comment #24 from Steve Kargl <sgk at troutmask dot apl.washington.edu> 2011-08-26 17:23:11 UTC --- On Fri, Aug 26, 2011 at 10:05:32AM +0000, boschmann at tp1 dot physik.uni-siegen.de wrote: > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170 > > --- Comment #23 from Hans-Werner Boschmann <boschmann at tp1 dot > physik.uni-siegen.de> 2011-08-26 10:05:32 UTC --- > Is there any chance that gfortran 4.7.0 will support allocatable character > lengths? As you know, gfortran already has support for a deferred type parameter. Yes, there are some bugs, but no one has had time to track down the few remaining issues. Looking at your code in comment #17, one can easily find a trivial change to make it work. PROGRAM helloworld character(:),allocatable::string real::rnd do i = 1, 10 call random_number(rnd) call hello(ceiling(11*rnd),string) print '(A,1X,I0)', '>' // string // '<', len(string) end do contains subroutine hello (n,string) character(:),allocatable,intent(out)::string integer,intent(in)::n character(10)::helloworld="hello world" ! string=helloworld(:n) ! Does not work. ! string=(helloworld(:n)) ! Works. ! allocate(string, source=helloworld(:n)) ! Does not work. allocate(string, source=(helloworld(:n))) ! Works. end subroutine hello end PROGRAM helloworld troutmask:sgk[217] gfc4x -o z foo.f90 && ./z >hello worl< 11 >hello w< 7 >hello worl< 11 >hello wor< 9 >hello< 5 >hello < 6 >h< 1 >h< 1 >hell< 4 >hell< 4 Your code in comment #14 is (I believe) invalid, and gfortran is issuing the correct error message.