https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125379
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Thomas Koenig <[email protected]>: https://gcc.gnu.org/g:449a42185a6cf304325d905544cecbbca8164284 commit r17-649-g449a42185a6cf304325d905544cecbbca8164284 Author: Thomas Koenig <[email protected]> Date: Thu May 21 15:34:04 2026 +0200 Fix PR 125379, ICE with BIND(C) and PRIVATE This fixes a recent regression introduced by my patch for PR 125902. The problem was that, for private entities, the symbols cannot be found by gfc_find_symbol a gsymbol's namespace. This patch uses the approach of iterating over all the symbols to look for the right name if direct lookup fails. gcc/fortran/ChangeLog: PR fortran/125379 * gfortran.h (gfc_find_symbol_by_name): Add prototype. * resolve.cc (gfc_verify_binding_labels): Call gfc_find_symbol_by_name if direct lookup fails. * symbol.cc (compare_target_sym_name): New function. (gfc_find_symbol_by_name): New function. gcc/testsuite/ChangeLog: PR fortran/125379 * gfortran.dg/binding_label_tests_38.f90: New test.
