This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] PR 32535 - namelist with private items contained in sub-sub-procedure of a module rejected
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "Fortran List" <fortran at gcc dot gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org, "Tobias Burnus" <burnus at net-b dot de>
- Date: Sat, 7 Jul 2007 22:09:36 +0200
- Subject: [patch, fortran] PR 32535 - namelist with private items contained in sub-sub-procedure of a module rejected
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=googlemail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:mime-version:content-type; b=sYrYVzhUgZ3JgBufR1iZK77WjpwN0kPY7Z/pKrvbF8ppX5qeaYbZveDXEjKoUl6naZpCY1/8s/GgFZaBYJGusChagg4kJDacAcNmHE0YqF8SKjKijoMrAOQLU5B53GzIxM4dSrwlXhlKjrM1z/AaTAlpH3KcAEER1n9PACAjp6M=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=beta; h=received:message-id:date:from:to:subject:cc:mime-version:content-type; b=MN/UljaqBeSc+ckxHCUoQekTO4lYjlQD0P8T1Rq+/UoN+TJesMCeUbGLwqrKM2MegDsQ2aOVnRmjcdQ7Uyk/1+APVEtZbN7e92oAMZX3Hu7tLp+24XDRwMMY1+rBRrCKic9ezzXFoerDlWZl5Sp87XZMSNNZVsCD4rS0QPdnPC0=
Hi all,
here is a very simple fix for PR 32535, including testcase.
See http://gcc.gnu.org/ml/fortran/2007-06/msg00488.html
Would be nice if someone could have a look at it and commit it in case it's ok.
I ran "make check-gfortran" and only got the same regression that
Christopher recently reported:
FAIL: gfortran.fortran-torture/compile/pr32417.f90, "-O" (internal
compiler error)
So it seems like this problem was not introduced by my patch.
Cheers,
Janus
Index: gcc/testsuite/gfortran.dg/pr32535.f90
===================================================================
--- gcc/testsuite/gfortran.dg/pr32535.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/pr32535.f90 (revision 0)
@@ -0,0 +1,31 @@
+! { dg-do compile }
+!
+! PR32535: namelist with private items contained in sub-sub-procedure of a module rejected
+!
+! Contributed by Janus Weil <jaydub66@gmail.com>
+
+module mo
+
+implicit none
+
+real,private:: a,b,c
+
+contains
+
+ subroutine sub
+ implicit none
+ namelist /nl1/ a,b,c
+
+ contains
+
+ subroutine subsub
+ implicit none
+ namelist /nl2/ a,b,c
+
+ end subroutine subsub
+
+ end subroutine sub
+
+end module mo
+
+! { dg-final { cleanup-modules "mo" } }
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 126442)
+++ gcc/fortran/resolve.c (working copy)
@@ -6876,7 +6876,7 @@
for (nl = sym->namelist; nl; nl = nl->next)
{
if (!nl->sym->attr.use_assoc
- && !(sym->ns->parent == nl->sym->ns)
+ && !(sym->ns->parent == nl->sym->ns) && !(sym->ns->parent!=0 && sym->ns->parent->parent == nl->sym->ns)
&& !gfc_check_access(nl->sym->attr.access,
nl->sym->ns->default_access))
{