F2003 supported
  ALLOCATE( A, SOURCE=B)
where the dynamic type of B determined the dynamic type of A plus where the
values where copied from B to A.

Fortran 2008 now also offers MOLD= where only the type is used, but no data is
copied.

Fortran 2008 draft FDIS: ftp://ftp.nag.co.uk/sc22wg5/N1801-N1850/N1814.pdf

R626 allocate-stmt is ALLOCATE ( [ type-spec :: ] allocation-list [,
alloc-opt-list ] )
R627 alloc-opt  is  ERRMSG = errmsg-variable
                or  MOLD = source-expr
                or  SOURCE = source-expr
                or  STAT = stat-variable

"If MOLD= appears and source-expr is a variable, its value need not be
defined."


And in the introduction one finds the following:

"A structure constructor can omit the value for an allocatable component.
SOURCE= in an ALLOCATE statement can give an array variable the bounds as well
as the value of an expression. MOLD= in an ALLOCATE statement can give a
polymorphic variable the shape, type, and type parameters of an expression
without copying the value."


-- 
           Summary: [F2008][OOP] ALLOCATE with MOLD=
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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

Reply via email to