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.

and it appears that it is not handled correctly.

gfortran.dg/namelist_use_only.f90 is using a namelist-group-name from the
module.

Reply via email to