re PR fortran/32535 (namelist with private items contained in sub-sub-procedure of...
authorJanus Weil <jaydub66@gmail.com>
Tue, 17 Jul 2007 21:33:34 +0000 (21:33 +0000)
committerTobias Burnus <burnus@gcc.gnu.org>
Tue, 17 Jul 2007 21:33:34 +0000 (23:33 +0200)
2007-07-17  Janus Weil  <jaydub66@gmail.com>

PR fortran/32535
* resolve.c (resolve_fl_namelist): Check for namelist private
components in contained subprograms.

2007-07-17  Janus Weil  <jaydub66@gmail.com>

PR fortran/32535
* gfortran.dg/pr32535.f90: New test.

From-SVN: r126706

gcc/fortran/ChangeLog
gcc/fortran/resolve.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr32535.f90 [new file with mode: 0644]

index 726fd18..2b46228 100644 (file)
@@ -1,3 +1,9 @@
+2007-07-17  Janus Weil  <jaydub66@gmail.com> 
+
+       PR fortran/32535
+       * resolve.c (resolve_fl_namelist): Check for namelist private 
+       components in contained subprograms.
+
 2007-07-17  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/31320
index aa3c809..d335f36 100644 (file)
@@ -6969,6 +6969,8 @@ resolve_fl_namelist (gfc_symbol *sym)
        {
          if (!nl->sym->attr.use_assoc
              && !(sym->ns->parent == nl->sym->ns)
+             && !(sym->ns->parent
+                  && sym->ns->parent->parent == nl->sym->ns)
              && !gfc_check_access(nl->sym->attr.access,
                                   nl->sym->ns->default_access))
            {
index ec808de..e1a8f1f 100644 (file)
@@ -1,3 +1,8 @@
+2007-07-17  Janus Weil  <jaydub66@gmail.com>
+
+       PR fortran/32535
+       * gfortran.dg/pr32535.f90: New test.
+
 2007-07-17  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/31320
diff --git a/gcc/testsuite/gfortran.dg/pr32535.f90 b/gcc/testsuite/gfortran.dg/pr32535.f90
new file mode 100644 (file)
index 0000000..43ea48e
--- /dev/null
@@ -0,0 +1,26 @@
+! { 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" } }