This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/45170] [F2003] allocatable character lengths
- From: "boschmann at tp1 dot physik.uni-siegen.de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Jul 2011 15:01:06 +0000
- Subject: [Bug fortran/45170] [F2003] allocatable character lengths
- Auto-submitted: auto-generated
- References: <bug-45170-4@http.gcc.gnu.org/bugzilla/>
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.