https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126872
--- Comment #3 from Harald Anlauf <anlauf at gcc dot gnu.org> ---
I don't have 16.2.0 here, but
GNU Fortran (GCC) 16.2.1 20260809
which is only a few commits after 16.2.0 release, and I do not see anything
suspicious. I use openSUSE Leap 16.0, but do not think that it would be so
much different from Redhat.
I get
% gfc-16 -c -fPIC pr126872.f90 -shared -o libmoduleA.so && nm libmoduleA.so
0000000000000000 T doThing
for both variants with private commented/uncommented.
However, the assembler looks different: the version with "private" has a line
.hidden doThing
which may lead to different behaviour on your system, but not mine. But why?