This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/33497] Bind(C): C_LOC rejects interoperable arguments



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]