http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170

--- Comment #17 from Hans-Werner Boschmann <boschmann at tp1 dot 
physik.uni-siegen.de> 2011-07-12 15:00:22 UTC ---
This sounds like there is still a lot of work to do in this character issue.
Has anyone ever managed to allocate such strings dynamically? In 

(In reply to comment #15)
> character(:),allocatable::string
> string='yes!!'
> print *, string
> end

the length is constant so you could use character(5)::string. That's not what I
mean, I would like to have something like this:

PROGRAM helloworld
  character(:),allocatable::string
  real::rnd
  call random_number(rnd)
  call hello(ceiling(11*rnd),string)
  print *,string
contains
  subroutine hello (n,string)
    character(:),allocatable,intent(out)::string
    integer,intent(in)::n
    character(10)::helloworld="hello world"
    string=helloworld(:n)
  end subroutine hello
end PROGRAM helloworld

I guess that's not yet possible with gfortran.

Reply via email to