re PR fortran/33818 (Bogus error "Variable 'str' is used at (1) before the ENTRY...
authorTobias Burnus <burnus@net-b.de>
Sat, 20 Oct 2007 11:34:21 +0000 (13:34 +0200)
committerTobias Burnus <burnus@gcc.gnu.org>
Sat, 20 Oct 2007 11:34:21 +0000 (13:34 +0200)
2007-10-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33818
        * resolve.c (resolve_variable): Check that symbol is in the same
        namespace as the entry function.

2007-10-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/33818
        * gfortran.dg/entry_dummy_ref_3.f90: New.

From-SVN: r129510

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

index 14e65ca582abc95450d3cd2772c29c5862c2a5ca..8616a595f8c9a5557027b172625ce3898e26a738 100644 (file)
@@ -1,3 +1,9 @@
+2007-10-20  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/33818
+       * resolve.c (resolve_variable): Check that symbol is in the same
+       namespace as the entry function.
+
 2007-10-20  Paul Thomas  <pault@gcc.gnu.org>
            FX Coudert <fxcoudert@gcc.gnu.org>
 
index dffa76e0cff20dd11147f3f74584257fb13aa95c..2ddc2b5605e11de2be3b579cdf33db9fba67e8c0 100644 (file)
@@ -3935,7 +3935,7 @@ resolve_variable (gfc_expr *e)
       bool seen;
 
       /* If the symbol is a dummy...  */
-      if (sym->attr.dummy)
+      if (sym->attr.dummy && sym->ns == gfc_current_ns)
        {
          entry = gfc_current_ns->entries;
          seen = false;
@@ -3952,8 +3952,8 @@ resolve_variable (gfc_expr *e)
          if (!seen)
            {
              if (specification_expr)
-               gfc_error ("Variable '%s',used in a specification expression, "
-                          "is referenced at %L before the ENTRY statement "
+               gfc_error ("Variable '%s', used in a specification expression"
+                          "is referenced at %L before the ENTRY statement "
                           "in which it is a parameter",
                           sym->name, &cs_base->current->loc);
              else
index 65ec81916571333053070f6a868e4a0dbac9ba54..c10c500b48ef6978099cce9d55095c8a41e17573 100644 (file)
@@ -1,3 +1,8 @@
+2007-10-20  Tobias Burnus  <burnus@net-b.de>
+
+       PR fortran/33818
+       * gfortran.dg/entry_dummy_ref_3.f90: New.
+
 2007-10-20  Paul Thomas  <pault@gcc.gnu.org>
            FX Coudert <fxcoudert@gcc.gnu.org>
 
diff --git a/gcc/testsuite/gfortran.dg/entry_dummy_ref_3.f90 b/gcc/testsuite/gfortran.dg/entry_dummy_ref_3.f90
new file mode 100644 (file)
index 0000000..379f6fb
--- /dev/null
@@ -0,0 +1,25 @@
+! { dg-do compile }
+!
+! PR fortran/33818
+!
+
+subroutine ExportZMX(lu)
+  implicit none
+  integer :: lu
+  interface
+    function LowerCase(str)
+      character(*),intent(in) :: str
+      character(len(str))     :: LowerCase
+    end function LowerCase
+  end interface
+  character(*),parameter :: UNAME(1:1)=(/'XXX'/)
+  write(lu,'(a)') 'UNIT '//UpperCase(UNAME(1))
+  write(lu,'(a)') 'Unit '//LowerCase(UNAME(1))
+entry ExportSEQ(lu)
+contains
+  function UpperCase(str) result(res)
+    character(*),intent(in) :: str
+    character(len(str)) res
+    res=str
+  end function
+end