http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50408
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-11-24 22:13:06 UTC --- That a -fwhole-file regression, which became the default in 4.6. The work around is -fno-whole-file. The problem is in gfc_get_extern_function_decl: gfc_find_symbol (sym->name, gsym->ns, 0, &s); if (s && s->backend_decl) { sym->backend_decl = s->backend_decl; return sym->backend_decl; } The problem is that this does not set sym->ts.u.derived{,->components{,->next}}->backend_decl for BT_DERIVED/BT_CLASS; one might also need to update sym->ts.u.cl... for BT_CHARACTER. Note: There are more places in trans*.c which call gfc_find_gsymbol