[Bug fortran/126872] [16,17 Regression] Change in visibility of C bound functions with 16.2.0

"jvdelisle at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126872

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Change in visibility of C   |[16,17 Regression] Change
                   |bound functions with 16.2.0 |in visibility of C bound
                   |                            |functions with 16.2.0
           Assignee|unassigned at gcc dot gnu.org      |jvdelisle at gcc dot gnu.org

--- Comment #8 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Confirmed the 125430 patch did it. This was Claude assisted commit pre AI
policy. Using Claude Opus to analyze it. The fix is rather simple.

From Claude:

Confirmed — it's a real regression, and it's ours.

┌──────────────────────────────────┬───────────────────────────────┐
│             Compiler             │            Result             │
├──────────────────────────────────┼───────────────────────────────┤
│ 13.4.1, 14.4.1, 15.3.1           │ GLOBAL DEFAULT — not affected │
├──────────────────────────────────┼───────────────────────────────┤
│ 16.1.1 (gcc-16 branch, 20260728) │ GLOBAL HIDDEN — affected      │
├──────────────────────────────────┼───────────────────────────────┤
│ 17.0.0 trunk (20260814)          │ GLOBAL HIDDEN — affected      │
└──────────────────────────────────┴───────────────────────────────┘

With explicit public :: doThing, all versions give GLOBAL DEFAULT, matching the
reporter's observation.

Note the symbol isn't actually made static — it stays GLOBAL but gets
STV_HIDDEN, so it's T in the .o and only collapses to t in nm after the shared
link. Same practical breakage for the user (not exported from the DSO), but
worth stating precisely in the PR.

Cause: commit 1cf8c5913bf (trunk, 2026-05-22, "module-contained PRIVATE
procedures must have global ELF linkage [PR125430]"), backported to gcc-16 as
63ba0af1843. That commit is in releases/gcc-16.2.0 but not 16.1.0 — exactly
matching the reporter seeing 16.1 good / 16.2 bad. gcc-15 never got it.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.