https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111218
Rimvydas (RJ) <rimvydas.jas at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rimvydas.jas at gmail dot com --- Comment #4 from Rimvydas (RJ) <rimvydas.jas at gmail dot com> --- Another testcase resulting in identical ICE. $ cat test.f90 module foo1 interface !bail ! generic works ok subroutine bail() bind(c,name="bail_") end subroutine end interface end module foo2 interface !bail subroutine sfx_bail(k) integer :: k end subroutine end interface end module foo use foo1 use foo2 , bail => sfx_bail end subroutine unice_dummy ! avoid ice end $ ./gcc/f951 test.f90 test.f90:21:22: 21 | subroutine unice_dummy | 1 Error: Name 'bail' at (1) is an ambiguous reference to 'bail' from module 'foo1' Using extra dummy unit at the end of file helps to avoid the ICE (avoids ICE on original case too), but notice the wrong locus. Issue here happens because ambiguous_symbol() is called after parsing was already done, resulting in nullification of gfc_current_locus global in gfc_advance_line () at gcc/fortran/scanner.cc:651 651 gfc_current_locus.nextc = NULL; So the "%C" cannot be used in gcc/fortran/symbol.cc:3167 gfc_error ("Name %qs at %C is an ambiguous reference to %qs " Note: there is an assertion in gcc/fortran/error.cc:1078 gcc_assert (loc->nextc - loc->lb->line >= 0); Question is weather bind(c) rename attribute should somehow affect interface generic status in any way? Testcase does pass with bind(c) commented out or with explicitly marked interface as generic in foo1.