[Bug fortran/45170] [F2003] allocatable character lengths
boschmann at tp1 dot physik.uni-siegen.de
gcc-bugzilla@gcc.gnu.org
Tue Jul 12 15:01:00 GMT 2011
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.
More information about the Gcc-bugs
mailing list