[Bug fortran/45170] [F2003] allocatable character lengths
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue May 15 13:09:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170
--- Comment #34 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-05-15 12:54:36 UTC ---
(In reply to comment #24)
> call hello(ceiling(11*rnd),string)
That should be floor or "10" - otherwise, it can give "11" which is too large.
(Or and better: Change the "10" to "11" below then "hello worl(d)" fits into
the string.)
> integer,intent(in)::n
> character(10)::helloworld="hello world"
> string=helloworld(:n) ! Does not work.
Interestingly, it works if one does not use "n" as argument but sets it in the
procedure. One then gets code like:
*string = ... __builtin_malloc ( ... MAX_EXPR <n, 0> )
However, if "n" is passed as dummy argument, one has:
integer(kind=4) D.1865;
*string = ... __builtin_malloc ( ... MAX_EXPR <D.1865, 0> )
D.1865 = *nnnn;
Or in other words: The order is wrong.
More information about the Gcc-bugs
mailing list