[Bug fortran/48887] New: [OOP] SELECT TYPE: Associate name shall not be a pointer/allocatable
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu May 5 13:11:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48887
Summary: [OOP] SELECT TYPE: Associate name shall not be a
pointer/allocatable
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
CC: janus@gcc.gnu.org, domob@gcc.gnu.org
>From F2008, 16.5.1.6 Construct association:
"If the selector is allocatable, it shall be allocated; the associate name is
associated with the data object and does not have the ALLOCATABLE attribute.
"If the selector has the POINTER attribute, it shall be associated; the
associate name is associated with the target of the pointer and does not have
the POINTER attribute."
However, gfortran accepts the following, ifort and NAG don't.
It works if the associate name is explicitly given using "associate-name =>
selector"; however, it does not change the POINTER/ALLOCATABLE issue as: "The
associate name of a SELECT TYPE construct is the associate-name if specified;
otherwise it is the name that constitutes the selector."
type t
end type t
class(t), allocatable :: alloc
class(t), pointer :: ptr
select type(alloc)
type is (t)
allocate(alloc) ! INVALID: "alloc" is not allocatable
end select
select type(ptr)
type is (t)
nullify(ptr) ! INVALID: "ptr" is not a pointer
end select
end
For an longer example, see
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/88b65a2c9024e95f
More information about the Gcc-bugs
mailing list