Hi Jerry, Contrary to my remarks on Mattermost, this patch fixes PRs 88632 and 104630 with the assistance of my tentative patch for pr125429 was totally spurious: It does it on its own! It regression tests without errors.
I would consider losing the first comment in trans-decl.cc. It is essentially repeated in the second one and its second sentence says what any fortran developer must know already. Now that I see the substance of the patch, it looks rather 'obvious'. OK for mainline and, I would suggest, immediate backport to 16-branch. Regards Paul On Wed, 27 May 2026 at 16:21, Jerry D <[email protected]> wrote: > > See attached patch. This bug found when trying to build the Formal package. > > Developed with with Assistance from Claude Sonnet 4.6. Two new testsuite > files > provided. The change wiggled on a few exiting test cases. > > Regression tested on x86_64 Linux. > > OK for mainline? What about backport? > > Regards, > > Jerry > > ---- > > fortran: module-contained PRIVATE procedures must have global > ELF linkage [PR125430] > > 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. > > Assisted by: Claude Sonnet 4.6 > ---
