------- Comment #8 from mikael at gcc dot gnu dot org 2009-10-24 22:42 ------- (In reply to comment #7) > It seems that the patch in comment #2 has been silently applied Not exactly silently. It was pr38672
> Apparently the failure of the test in comment #4 is due to the fact that > c_funptr is not mangled the way it is defined (through different modules and > an > only clause). If I remove module 'a' and the comment in module 'b', the code > compiles. The whole iso_c_binding is messy because it doesn't look like normal modules. It hijacks functions everywhere to take care of iso_c_binding cases and doesn't benefit from the general code. Here, the derived type of the function c_funloc is given a mangled name because it is not wanted by the user. This seems to fix it : Index: symbol.c =================================================================== --- symbol.c (revision 153473) +++ symbol.c (working copy) @@ -4397,8 +4397,8 @@ (mod_name, s == ISOCBINDING_FUNLOC ? ISOCBINDING_FUNPTR : ISOCBINDING_PTR, (const char *)(s == ISOCBINDING_FUNLOC - ? "_gfortran_iso_c_binding_c_funptr" - : "_gfortran_iso_c_binding_c_ptr")); + ? "c_funptr" + : "c_ptr")); tmp_sym->ts.u.derived = get_iso_c_binding_dt (s == ISOCBINDING_FUNLOC ? ISOCBINDING_FUNPTR -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37829