http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45170
--- Comment #26 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-29
06:47:41 UTC ---
(In reply to comment #24)
> Your code in comment #14 is (I believe) invalid, and gfortran
> is issuing the correct error message.
I get:
Error: Variable 'length' cannot appear in the expression at (1)
However, I believe that
allocate(character(len=length)::string)
is valid.
One has (F2008):
R626 allocate-stmt is ALLOCATE ( [ type-spec :: ] allocation-list
[, alloc-opt-list ] )
with
R402 type-spec is intrinsic-type-spec or derived-type-spec
with
R404 intrinsic-type-spec is [...]
or CHARACTER [ char-selector ]
with
R420 char-selector is length-selector [or ...]
with
R421 length-selector is ( [ LEN = ] type-param-value ) [or ...]
Thus, I do not see any syntax problems; I also couldn't find any constraint or
other reason which renders the code in comment #14 invalid.