re PR fortran/26277 (false warning about unused label for a warning used in err=)
authorTobias Schlüter <tobi@gcc.gnu.org>
Tue, 14 Feb 2006 19:21:07 +0000 (20:21 +0100)
committerTobias Schlüter <tobi@gcc.gnu.org>
Tue, 14 Feb 2006 19:21:07 +0000 (20:21 +0100)
fortran/
PR fortran/26277
* io.c (match_ltag): Mark label as referenced.
testsuite/
PR fortran/26277
* gfortran.dg/label_4.f90: New.

From-SVN: r110993

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

index 7a36057..faf6975 100644 (file)
@@ -1,3 +1,8 @@
+2006-02-14  Tobias Schl\81üter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/26277
+       * io.c (match_ltag): Mark label as referenced.
+
 2006-02-14  Jakub Jelinek  <jakub@redhat.com>
            Richard Henderson  <rth@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>
index c88c74a..618d056 100644 (file)
@@ -972,6 +972,10 @@ match_ltag (const io_tag * tag, gfc_st_label ** label)
       return MATCH_ERROR;
     }
 
+  if (m == MATCH_YES 
+      && gfc_reference_st_label (*label, ST_LABEL_TARGET) == FAILURE)
+    return MATCH_ERROR;
+
   return m;
 }
 
index d12f874..cb15ef6 100644 (file)
@@ -1,3 +1,8 @@
+2006-02-14  Tobias Schlüter  <tobias.schlueter@physik.uni-muenchen.de>
+
+       PR fortran/26277
+       * gfortran.dg/label_4.f90: New.
+
 2006-02-14  Jakub Jelinek  <jakub@redhat.com>
            Diego Novillo  <dnovillo@redhat.com>
            Uros Bizjak  <uros@kss-loka.si>
diff --git a/gcc/testsuite/gfortran.dg/label_4.f90 b/gcc/testsuite/gfortran.dg/label_4.f90
new file mode 100644 (file)
index 0000000..68b2291
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! { dg-options "-Wunused-labels" }
+! PR 26277
+! We used to give an incorect warning about label 99 not being referenced
+  open(unit=12,err=99)
+99 print *,"could not open file ..."
+98 continue ! { dg-warning "Label 98 .* defined but not used" }
+end