https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123321
--- Comment #8 from van.snyder at sbcglobal dot net <van.snyder at sbcglobal dot net> --- On Sat, 2025-12-27 at 21:57 +0000, kargl at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123321 > > --- Comment #6 from Steve Kargl <kargl at gcc dot gnu.org> --- > (In reply to anlauf from comment #4) > > (In reply to Steve Kargl from comment #3) > > > which then fixes the issue. I however do not understand the only > > > logic in trans-io.cc. The code is > > > > > > /* Build the namelist object name. */ > > > if (sym && !sym->attr.use_only && sym->attr.use_rename > > > && sym->ns->use_stmts->rename) > > > string = gfc_build_cstring_const > > > (sym->ns->use_stmts->rename->local_name); > > > else > > > string = gfc_build_cstring_const (var_name); > > > string = gfc_build_addr_expr (pchar_type_node, string); > > > > > > The negated sym->attr.use_only seems to short-circuit the > > > actually > > > use of a renamed symbol? > > > > An explanation may be given by reading pr105847. > > Indeed, comment #11 in that PR contains (updated to F2023) > > C8107 (R871) The namelist-group-name shall not be a name > accessed by use association. In the bug I posted, the namelist-group-name is local to the main program, not accessed by use association. It's a namelist-group-onject, which 8.9 "Namelist Statement" p5 (F18, and F25 draft) explicitly says can be accessed by use association. > and it appears that it is not handled correctly. > > gfortran.dg/namelist_use_only.f90 is using a namelist-group-name from > the > module. >
