PR 24207 may interest you

Paul THOMAS paulthomas2@wanadoo.fr
Wed Oct 5 13:31:00 GMT 2005


Steve,

A reply on the list because the fix is common to PR24207 and the problem with the Polyhedron test induct.f90.  In both cases we must exclude use associated symbols from the error condition, for the reason described by Richard Maine.  The patch below works correctly for both.  Double thanks, Richard.

All the best

Paul T

> Paul,
> 
> I filed PR 24207 about a PRIVATE/PUBLIC interaction and NAMELIST. I
> derived the failing code from code available at http://fire.nist.gov/fds/. 
> 
> In short, we have
> 
> module a
> implicit none
> real b
> end module a
> 
> module c
> use a
> implicit none
> private
> contains
> subroutine d
> namelist /e/ b
> read(5,e)
> end subroutine d
> end module c
> 
> troutmask:sgk[205] gfc -c z.f90
> In file z.f90:12
> 
> namelist /e/ b
> 1
> Error: PRIVATE symbol 'b' cannot be member of PUBLIC namelist at (1)
> 
> -- 
> Steve
> 
> 
*** gcc/gcc/fortran/resolve.c.wrong     Wed Oct  5 10:43:32 2005
--- gcc/gcc/fortran/resolve.c   Wed Oct  5 14:10:06 2005
*************** resolve_symbol (gfc_symbol * sym)
*** 4330,4335 ****
--- 4330,4336 ----
        {
          if (arg->sym
                && arg->sym->ts.type == BT_DERIVED
+               && !arg->sym->ts.derived->attr.use_assoc
                && !gfc_check_access(arg->sym->ts.derived->attr.access,
                                     arg->sym->ts.derived->ns->default_access))
            {
*************** resolve_symbol (gfc_symbol * sym)
*** 4432,4438 ****
        {
          for (nl = sym->namelist; nl; nl = nl->next)
            {
!             if (!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,
--- 4433,4441 ----
        {
          for (nl = sym->namelist; nl; nl = nl->next)
            {
!             if (!nl->sym->attr.use_assoc
!                   &&
!                 !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,





More information about the Fortran mailing list