This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33497] Bind(C): C_LOC rejects interoperable arguments
- From: "sfilippone at uniroma2 dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Sep 2007 17:29:44 -0000
- Subject: [Bug fortran/33497] Bind(C): C_LOC rejects interoperable arguments
- References: <bug-33497-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from sfilippone at uniroma2 dot it 2007-09-19 17:29 -------
A version with an inner pointer to a derived type instead of allocatable array
fails as well.
-----------------
module c_vhandle_mod
use iso_c_binding
type foo
integer :: i
end type foo
type foo_item
type(foo), pointer :: v=> null()
end type foo_item
type(foo_item), allocatable :: foo_pool(:)
contains
type(c_ptr) function get_foo_address(handle)
integer(c_int), intent(in) :: handle
get_foo_address = c_loc(foo_pool(handle)%v)
end function get_foo_address
end module c_vhandle_mod
-------------------------
[sfilippo@localhost bugtest]$ /usr/local/gcc43/bin/gfortran -c c_vh_2_mod.f90
c_vh_2_mod.f90:18.28:
get_foo_address = c_loc(foo_pool(handle)%v)
1
Error: Parameter 'foo_pool' to 'c_loc' at (1) must be either a TARGET or an
associated pointer
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33497