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/32600] [ISO Bind C] C_LOC/C_FUNLOC should not be library functions



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


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