This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51961] New: [OOP] ALLOCATE with MOLD= rejects if source-expr has a different rank
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Jan 2012 10:53:05 +0000
- Subject: [Bug fortran/51961] New: [OOP] ALLOCATE with MOLD= rejects if source-expr has a different rank
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51961
Bug #: 51961
Summary: [OOP] ALLOCATE with MOLD= rejects if source-expr has
a different rank
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
Fortran 2008 has:
C638 (R626) Each allocate-object shall be type compatible (4.3.1.3) with
source-expr. If SOURCE= appears, source-expr shall be a scalar or
have the same rank as each allocate-object.
gfortran properly diagnoses this for SOURCE, but it also diagnoses it for MOLD=
which is valid:
allocate (a(2), mold=b) ! Valid
2 1
Error: Source-expr at (1) must be scalar or have the same rank as the
allocate-object at (2)
type t
end type t
class(T), allocatable :: a(:), b(:,:)
allocate(b(2,2))
allocate (a(2), source=b) ! Invalid - and correctly rejected
allocate (a(2), mold=b) ! Valid - but not accepted
end