User account creation filtered due to spam.
Reported by Angelo Graziosi at http://gcc.gnu.org/ml/fortran/2013-04/msg00210.html Using in file1: module m ... type t type(c_funptr) :: funptr end type and in file2: use iso_c_binding, ONLY: c_funloc use m type(t) :: x ... x%funptr = c_funloc(proc) fails with: Error: Can't convert TYPE(c_funptr) to INTEGER(4) at (1) The problem is that the .mod file only contains: win32_types.mod:5 'C_funptr' '__iso_c_binding' '' 1 ((DERIVED UNKNOWN-INTENT while the symtree is searched for "c_funptr". Workaround: Editing the .mod file and changing C_funptr to c_funptr.
On x86_64-apple-darwin13, I get with gfortran 4.8.2 [Book15] f90/bug% gfortran pr57048.f90 [Book15] f90/bug% grep funptr m.mod (('c_funptr' '__iso_c_binding' 2) ('t' 'm' 3)) (2 'C_funptr' '__iso_c_binding' '' 1 ((DERIVED UNKNOWN-INTENT DERIVED 2 0 1 1 UNKNOWN ()) 0 0 () () 0 ((4 '__c_funptr_c_address' ( (UNKNOWN 0 0 0 0 UNKNOWN ()) 0 0 () () 0 ((5 'funptr' (DERIVED 2 0 0 0 7 'c_funptr' '__iso_c_binding' '' 1 ((PROCEDURE UNKNOWN-INTENT ('C_funptr' 0 2 'T' 0 3 '__iso_c_binding' 0 6 'c_funptr' 0 7 'm' 0 8 't' What is setting the capital C and why?
This fixes this case; However, it is not free of regressions. diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index adc34dd..24ceaea 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -2366,8 +2366,6 @@ gfc_get_derived_type (gfc_symbol * derived) else derived->backend_decl = pfunc_type_node; - derived->ts.kind = gfc_index_integer_kind; - derived->ts.type = BT_INTEGER; /* Set the f90_type to BT_VOID as a way to recognize something of type BT_INTEGER that needs to fit a void * for the purpose of the iso_c_binding derived types. */
Created attachment 31956 [details] Bigger patch (doesn't work better :-/ ) And this is how far I got before giving up.
GCC 4.9.0 has been released
GCC 4.9.1 has been released.
GCC 4.9.2 has been released.
GCC 4.9.3 has been released.
GCC 4.9 branch is being closed