This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/41599] New: [OOP] SELECT TYPE with associate-name => exp: Use (sometimes) a restricted pointer
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Oct 2009 07:58:25 -0000
- Subject: [Bug fortran/41599] New: [OOP] SELECT TYPE with associate-name => exp: Use (sometimes) a restricted pointer
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Currently, an unrestricted pointer is generated. It should be an restricted
pointer if the expression is not a POINTER or TARGET.
One has to be careful, however:
class(t),allocatable :: bar
allocate(t::a%bar)
select type (foo => bar)
is type(t)
foo%item = 8
bar%item = 9
Here, both items alias - I do not know whether this code is valid or not,
however.
Ditto for
type t2
class(t) :: bar
end type t2
type(t2) :: a
allocate(t::a%bar)
select type (foo => a%bar)
is type(t)
foo%item = 8
a%bar%item = 9
Similarly for:
type t2
class(t),allocatable :: bar
end type t2
type(t2), pointer :: a
allocate(a)
allocate(t::a%bar)
select type (foo => a%bar)
is type(t)
foo%item = 8
a%bar%item = 9
Thus before fixing this, one needs to read the standard carefully.
--
Summary: [OOP] SELECT TYPE with associate-name => exp: Use
(sometimes) a restricted pointer
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41599