https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125430
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:1cf8c5913bfe8016b8b2436cc17a7577be1b295f commit r17-913-g1cf8c5913bfe8016b8b2436cc17a7577be1b295f Author: Jerry DeLisle <[email protected]> Date: Fri May 22 21:56:34 2026 -0700 fortran: module-contained PRIVATE procedures must have global ELF linkage [PR125430] Assisted by: Claude Sonnet 4.6 gcc/fortran/ChangeLog: PR fortran/125430 * trans-decl.cc (build_function_decl): Set TREE_PUBLIC for all module-contained procedures so submodules compiled as separate translation units can reach them via host association. Also set DECL_VISIBILITY to VISIBILITY_HIDDEN for PRIVATE procedures, matching the existing treatment of module variables. gcc/testsuite/ChangeLog: PR fortran/125430 * gfortran.dg/module_private_2.f90: Remove scan-tree-dump-times assertion for 'priv'; PRIVATE module procedures now have global linkage with hidden visibility and are no longer optimized away. * gfortran.dg/public_private_module_2.f90: Add xfail markers to scan-assembler-not for 'two' and 'six'; update comment to mention procedures alongside variables. * gfortran.dg/public_private_module_7.f90: Add xfail marker to scan-assembler-not for '__m_common_attrs_MOD_other'. * gfortran.dg/public_private_module_8.f90: Add xfail marker to scan-assembler-not for '__m_MOD_myotherlen'. * gfortran.dg/submodule_private_host.f90: New test. * gfortran.dg/submodule_private_host_aux.f90: New auxiliary file. * gfortran.dg/warn_unused_function_2.f90: Remove 'defined but not used' expectation for s1; PRIVATE module procedures now have global linkage and no longer trigger the unused-function warning.
