[Bug fortran/88632] [F08] function contained in module invisible to submodule unless declared public

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 24 09:53:09 GMT 2026


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88632

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Paul Thomas <pault@gcc.gnu.org>:

https://gcc.gnu.org/g:c2d5855c8746bcee5ed9f8c5768ea3a3944368f1

commit r16-9583-gc2d5855c8746bcee5ed9f8c5768ea3a3944368f1
Author: Paul Thomas <pault@gcc.gnu.org>
Date:   Mon Jun 1 12:40:53 2026 +0100

    Fortran: Fix submodule access to private symbols in parent module
[PR88632,104630]

    PRs 88632 and 104630 both suffered link a problem, where a private
procedure
    in a parent module was not visible in a descendent submodule if they were
    compiled separately.

    The fix is to not filter out private symbols when writing the .smod file.
    Submodules are descendants of their ancestor module and access private
symbols
    in the module's contains section via host association (F2018 14.2.2).

    The testcase here is that of PR104630. However, it is functionally
identical
    to that of PR88632.

    2026-06-02  Paul Thomas  <pault@gcc.gnu.org>

    gcc/fortran
            PR fortran/88632
            PR fortran/104630
            * module.cc (write_symtree): Do not filter out private symbols
            when writing a submodule interface file (.smod).  Submodules are
            descendants of their ancestor module and access private symbols
            in the module's contains section via host association per
            Fortran 2018 section 14.2.2.

    gcc/testsuite/
            PR fortran/88632
            PR fortran/104630
            * gfortran.dg/submodule_35.f90: New test.
            * gfortran.dg/submodule_35_aux.f90: Submodule and program for
            for the new test.

            Assisted by: Claude Sonnet 4.6

    (cherry picked from commit 9fc5a7a25e9e29f58359c6363c9b10a99c6f99f0)


More information about the Gcc-bugs mailing list