re PR fortran/66056 (ICEs and endless compilation for lonely labels/numbers in type)
authorLouis Krupp <louis.krupp@zoho.com>
Mon, 26 Oct 2015 19:18:08 +0000 (19:18 +0000)
committerLouis Krupp <lkrupp@gcc.gnu.org>
Mon, 26 Oct 2015 19:18:08 +0000 (19:18 +0000)
2015-10-26  Louis Krupp  <louis.krupp@zoho.com>

PR fortran/66056
* fortran.h: Include namespace pointer in statement label
structure.
* symbol.c (gfc_get_st_label): Store pointer to namespace
that owns the statement label tree in each label.
(gfc_free_st_label): Use namespace owning statement label
tree when deleting statement label.
* io.c: Initialize format_asterisk with NULL namespace pointer.

2015-10-26  Louis Krupp  <louis.krupp@zoho.com>

PR fortran/66056
* gfortran.dg/empty_label_typedecl.f90: New test

From-SVN: r229390

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

index 181545117f64dbefc7203e4d220941cc94913063..51eeb0b61f534682291eb34f32f9a6f2a221da55 100644 (file)
@@ -1,3 +1,14 @@
+2015-10-26  Louis Krupp  <louis.krupp@zoho.com>
+
+       PR fortran/66056
+       * fortran.h: Include namespace pointer in statement label
+       structure.
+       * symbol.c (gfc_get_st_label): Store pointer to namespace
+       that owns the statement label tree in each label.
+       (gfc_free_st_label): Use namespace owning statement label
+       tree when deleting statement label.
+       * io.c: Initialize format_asterisk with NULL namespace pointer.
+
 2015-10-26  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/36192
index b2894cc22c46f8c36cba88f67dc918cdd9509d2d..90f63cf480771de4949a6e8ada8ebe20b7b3d34c 100644 (file)
@@ -1291,6 +1291,8 @@ typedef struct gfc_st_label
   tree backend_decl;
 
   locus where;
+
+  gfc_namespace *ns;
 }
 gfc_st_label;
 
index e5d68fb60badc52f51b5c62f761b6d6ff792bd64..dbd02b35e54caec43b3ca5edb5231a33b2b42222 100644 (file)
@@ -28,7 +28,7 @@ along with GCC; see the file COPYING3.  If not see
 
 gfc_st_label
 format_asterisk = {0, NULL, NULL, -1, ST_LABEL_FORMAT, ST_LABEL_FORMAT, NULL,
-                  0, {NULL, NULL}};
+                  0, {NULL, NULL}, NULL};
 
 typedef struct
 {
index a9a0dc07e5b2e3b10b318b45a1b8d84c1d357782..bd7758b9a45718f3138b45ad020cb0fb55651abe 100644 (file)
@@ -2195,7 +2195,7 @@ gfc_free_st_label (gfc_st_label *label)
   if (label == NULL)
     return;
 
-  gfc_delete_bbt (&gfc_current_ns->st_labels, label, compare_st_labels);
+  gfc_delete_bbt (&label->ns->st_labels, label, compare_st_labels);
 
   if (label->format != NULL)
     gfc_free_expr (label->format);
@@ -2260,6 +2260,7 @@ gfc_get_st_label (int labelno)
   lp->value = labelno;
   lp->defined = ST_LABEL_UNKNOWN;
   lp->referenced = ST_LABEL_UNKNOWN;
+  lp->ns = ns;
 
   gfc_insert_bbt (&ns->st_labels, lp, compare_st_labels);
 
index c0f8b0dbf64e81ca923732641514537cd449434e..7f4f8a09941c7965afc073c0f0c449daa3c5ee96 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-26  Louis Krupp  <louis.krupp@zoho.com>
+
+       PR fortran/66056
+       * gfortran.dg/empty_label_typedecl.f90: New test.
+
 2015-10-26  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/36192
diff --git a/gcc/testsuite/gfortran.dg/empty_label_typedecl.f90 b/gcc/testsuite/gfortran.dg/empty_label_typedecl.f90
new file mode 100644 (file)
index 0000000..c85e5be
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! { dg-options "-Werror" }
+subroutine s
+  type t
+  1 ! { dg-error "empty statement" }
+  end type
+end subroutine
+! { dg-excess-errors "warnings being treated as errors" }