This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch, fortran] PR 32535 - namelist with private items contained in sub-sub-procedure of a module rejected


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))
 	    {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]