http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51208
Bug #: 51208 Summary: [OOP] ALLOCATE with SOURCE= or MOLD=: Diagnose if variable occurs twice Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: accepts-invalid, diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassig...@gcc.gnu.org ReportedBy: bur...@gcc.gnu.org In ALLOCATE, one gets a diagnosis if one uses: integer, allocatable :: i allocate(i, stat=i) end Namely: allocate(i, stat=i) 1 Error: Stat-variable at (1) shall not be ALLOCATEd within the same ALLOCATE statement However, for SOURCE= and MOLD= it does not work: type t integer :: i = 4 end type t class(t), allocatable :: x, y allocate(t :: y) allocate(x, mold=x) ! Not diagnosed allocate(x, source=x) ! Not diagnosed The Intel compiler gives the error: error #8152: Neither the ERRMSG= variable nor any part of the source expression in SOURCE= or MOLD= specifiers may be allocated in the ALLOCATE statement in which it appears. [X]