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

           Summary: Deferred string length: ALLOCATE should allow MOLD=
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org


Currently, gfortran allows:

  character(len=:) :: str, str2
  ALLOCATE( str, SOURCE=str2)

but it does not allow for
  ALLOCATE( str, MOLD=str2)
which fails with
  Error: Allocate-object at (1) with a deferred type parameter requires either
a type-spec or SOURCE tag

Expected: MOLD (which is also a source-expr) is also accepted.


>From Fortran 2008 (which added MOLD=, which is already implemented in
gfortran):

C629 (R626) If any allocate-object has a deferred type parameter, is unlimited
polymorphic, or is of abstract type, either type-spec or source-expr shall
appear.

If source-expr is a pointer, it shall be associated with a target. If
source-expr is allocatable, it shall be allocated.
If MOLD= appears and source-expr is a variable, its value need not be defined.

Reply via email to