The code
use iso_c_binding
integer, target :: i
type(c_ptr) :: bar
bar = c_loc(i)
end
produces:
bar = c_loc (&i);
g95 produces:
bar = &i;;
and NAG f95:
bar_ = (char*) &i_;
Analogously for C_FUNPOINTER:
---------------
use iso_c_binding
interface
subroutine bar() bind(c)
end subroutine bar
end interface
type(c_funptr) :: fptr
fptr = c_funloc(bar)
end
---------------
gfortran:
void * fptr;
fptr = c_funloc (bar);
g95:
void (*<T34>) (void) fptr;
fptr = bar;;
NAG f95:
typedef void * __NAGf90_MODULE_iso_c_binding_DT_c_ptr;
typedef void (* __NAGf90_MODULE_iso_c_binding_DT_c_funptr)();
auto __NAGf90_MODULE_iso_c_binding_DT_c_funptr fptr_;
fptr_ = (void(*)())bar;
--
Summary: [ISO Bind C] C_LOC/C_FUNLOC should not be library
functions
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32600