This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/41777] Wrong-code with POINTER-returning GENERIC function
- 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: 21 Oct 2009 12:08:49 -0000
- Subject: [Bug fortran/41777] Wrong-code with POINTER-returning GENERIC function
- References: <bug-41777-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from burnus at gcc dot gnu dot org 2009-10-21 12:08 -------
Reduced test case. The problem is the GENERIC INTERFACE. For some reason, the
result attribute is not properly propagated. This leads to the bogus error:
print *, associated(a,f(a)) ! Valid, but error
1
Error: 'target' argument of 'associated' intrinsic at (1) must be a POINTER or
a TARGET
and to the wrong code by printing "T F" instead of "T T".
module m
type t2
integer :: i
end type t2
interface f
module procedure f2
end interface f
contains
function f2(a)
type(t2), pointer :: f2,a
f2 => a
end function f2
end module m
use m
implicit none
type(t2), pointer :: a
allocate(a)
!print *, associated(a,f(a)) ! Valid, but error
call cmpPtr(a,f2(a)) ! "T" which is OK
call cmpPtr(a,f(a)) ! "F" which is wrong
contains
subroutine cmpPtr(a,b)
type(t2), pointer :: a,b
print *, associated(a,b)
end subroutine cmpPtr
end
--
burnus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Summary|wrong-code with FoX, related|Wrong-code with POINTER-
|to ASSOCIATE( Ptr1, Ptr2) |returning GENERIC function
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41777