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

--- Comment #28 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-08-29 
16:34:34 UTC ---
(In reply to comment #27)
> >   R421 length-selector is ( [ LEN = ] type-param-value )  [or ...]
> 
> From F2003:
> 
> C402 (R402) The type-param-value for a kind type parameter shall be
> an initialization expression.
[...]
> allocate(character(len=length)::string)
> 
> length is not a constant.

Nor is it a "type-param-value for a *kind* type parameter" (emphasis by me). It
is a "length type parameter":

"1.3.147.12.4  length type parameter  type parameter whose value is permitted
to be assumed, deferred, or given by a specification expression"

In your case, it is deferred. Note that type-param-value is simply defined as:
  R401 type-param-value  is  scalar-int-expr  or  *  or  :
and
  "The values of the deferred type parameters of an object are determined by
successful execution of an ALLOCATE statement (6.7.1), execution of an
intrinsic assignment statement (7.2.1.3), execution of a pointer assignment
statement (7.2.2), or by argument association (12.5.2)."

Reply via email to