PRIVATE symbol in PUBLIC namelist
Tobias Burnus
burnus@net-b.de
Thu Jun 28 07:41:00 GMT 2007
Hallo Janus, hi all,
Janus Weil wrote:
> I just came across some strange behaviour of gfortran.
> namelist /nl2/ a,b,c
> Error: PRIVATE symbol 'a' cannot be member of PUBLIC namelist at (1)
This is a bug; can you fill a PR (problem report) in bugzilla?
The problem is how the checking is done in resolve.c's resolve_fl_namelist:
if (!nl->sym->attr.use_assoc
&& !(sym->ns->parent == nl->sym->ns)
&& !gfc_check_access(nl->sym->attr.access,
nl->sym->ns->default_access))
{
gfc_error ("PRIVATE symbol '%s' cannot be member of "
"PUBLIC namelist at %L", nl->sym->name,
&sym->declared_at);
return FAILURE;
}
This fails if the symbol is not in the parent, but in the parent->parent
namespace.
One solution would be to add
&& !(sym->ns->parent->parent == nl->sym->ns)
but maybe there is a better solution.
Thanks for finding the bug.
Tobias
More information about the Fortran
mailing list