This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32600] [ISO Bind C] C_LOC/C_FUNLOC should not be library functions
- 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: 2 Jul 2007 23:10:00 -0000
- Subject: [Bug fortran/32600] [ISO Bind C] C_LOC/C_FUNLOC should not be library functions
- References: <bug-32600-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from burnus at gcc dot gnu dot org 2007-07-02 23:09 -------
Analogously for c_f_pointer (without SHAPE) and c_f_funpointer:
use iso_c_binding
implicit none
integer, target :: tgt
type(c_ptr) :: cptr
integer, pointer :: ptr
cptr = c_loc(tgt)
call c_f_pointer(cptr,ptr)
end
gfortran:
c_f_pointer_i4 (cptr, &ptr, 0B);
g95:
ptr = cptr;;
NAG f95:
ptr_ = cptr_;
For shape, one can also consider generate the code directly.
gfortran and g95 call a library function but NAG f95 generates the C code
directly:
use iso_c_binding
implicit none
integer, target :: tgt(10)
type(c_ptr) :: cptr
integer, pointer :: ptr(:)
cptr = c_loc(tgt)
call c_f_pointer(cptr,ptr, (/ 10 /))
end
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32600