https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125430
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Jerry DeLisle <[email protected]>: https://gcc.gnu.org/g:63ba0af1843c2e7a65a451f440dead9c95ae9e24 commit r16-9113-g63ba0af1843c2e7a65a451f440dead9c95ae9e24 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. (cherry picked from commit 4d545cf40c23df3686bb9c0abdf5868a69ffe8fd)
