Summary: | Bind(C): C_LOC rejects interoperable arguments | ||
---|---|---|---|
Product: | gcc | Reporter: | Tobias Burnus <burnus> |
Component: | fortran | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | crickett, gcc-bugs, sfilippone |
Priority: | P3 | Keywords: | rejects-valid |
Version: | 4.3.0 | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | ||
Bug Depends on: | |||
Bug Blocks: | 32630 |
Description
Tobias Burnus
2007-09-19 12:16:55 UTC
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 Subject: Bug number PR 33497 A patch for this bug has been added to the patch tracker. The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01583.html Subject: Bug 33497 Author: burnus Date: Thu Sep 20 11:50:39 2007 New Revision: 128620 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=128620 Log: 2007-09-20 Christopher D. Rickett <crickett@lanl.gov> PR fortran/33497 * resolve.c (gfc_iso_c_func_interface): Use information from subcomponent if applicable. 2007-09-20 Christopher D. Rickett <crickett@lanl.gov> PR fortran/33497 * gfortran.dg/c_loc_tests_11.f03: New test case. Added: trunk/gcc/testsuite/gfortran.dg/c_loc_tests_11.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog Fixed on 4.3 (trunk). |