This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran, OOP] PR 43388: [F2008] ALLOCATE with MOLD=
Tobias Burnus wrote:
> No, C637 ensures that there is either a MOLD=source-expr or
> SOURCE=source-expr:
>
> "C637 (R626) At most one of source-expr and type-spec shall appear."
> (F2008 FDIS of 7th June 2010).
>
> Does the patch check for this constraint?
>
Other observations regarding ALLOCATE - not necessarily directly related
to the patch. I have not checked whether there are already PRs for those.
* MOLD= and default initializer: As Janus has correctly stated, MOLD
implies that the default initializer is used. If one searches for the
proposal email at J3, this is explicitly stated there. I think the patch
does not handle this for CLASS - please note this in the PR.
* The constraint C637 (cf. above) does not seem to be checked for.
* The following does not work although INTEGER is a valid type spec -
and with unlimited polymophism it makes sense that it is allowed:
INTEGER, ALLOCATE :: a
ALLOCATE (integer :: a)
("R402 type-spec is intrinsic-type-spec or derived-type-spec")
* The following does not compile although it does not violate C633:
integer, allocatable :: a(:), b(:)
allocate (a, source = b)
! The following is invalid and accepted:
allocate (a(3), source = b)
("C633 (R631) If allocate-object is an array either
allocate-shape-spec-list shall appear or source-expr shall appear and
have the same rank as allocate-object. If allocate-object is scalar,
allocate-shape-spec-list shall not appear.")
Tobias