[Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type)
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 4 19:06:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57530
Bug ID: 57530
Summary: [OOP] Wrongly rejects type_pointer => class_target
(which have identical declared type)
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
CC: janus at gcc dot gnu.org
Found in the examples to http://www.cambridge.org/rouson (->
ssdSource/chapter05/hermetic). According to comments, the original program is
accepted by xlf2003 and nagf95.
The following simplified code is accepted by Crayftn, ifort and pgf95, but
rejected by gfortran with:
ptr => tgt ! TYPE => CLASS
1
Error: Different types in pointer assignment at (1); attempted assignment of
CLASS(t) to TYPE(t)
>From F2008:
"C714 (R733) If data-target is not unlimited polymorphic, data-pointer-object
shall be type compatible (4.3.1.3) with it and the corresponding kind type
parameters shall be equal."
There (4.3.1.3): "A nonpolymorphic entity is type compatible only with entities
of the same declared type. A polymorphic entity that is not an unlimited
polymorphic entity is type compatible with entities of the same declared type
or any of its extensions."
In the example below, TYPE(t) and CLASS(t) have same declared type.
module m
type t
end type t
contains
subroutine sub (tgt)
class(t), target :: tgt
type(t), pointer :: ptr
ptr => tgt ! TYPE => CLASS
end subroutine sub
end module m
More information about the Gcc-bugs
mailing list