summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlkrupp <lkrupp@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-26 19:18:08 +0000
committerlkrupp <lkrupp@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-26 19:18:08 +0000
commitef8ded2296e85a9188ff60139561d0911cb19aa0 (patch)
treef41ac17695569bc67b62d585d4e84326662be4a5
parent3a52cf750bd9da06cffa7d642f1e74e77bfd8a8c (diff)
downloadgcc-ef8ded2296e85a9188ff60139561d0911cb19aa0.tar.gz
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 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229390 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/fortran/ChangeLog11
-rw-r--r--gcc/fortran/gfortran.h2
-rw-r--r--gcc/fortran/io.c2
-rw-r--r--gcc/fortran/symbol.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/empty_label_typedecl.f908
6 files changed, 29 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 181545117f6..51eeb0b61f5 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index b2894cc22c4..90f63cf4807 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -1291,6 +1291,8 @@ typedef struct gfc_st_label
tree backend_decl;
locus where;
+
+ gfc_namespace *ns;
}
gfc_st_label;
diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c
index e5d68fb60ba..dbd02b35e54 100644
--- a/gcc/fortran/io.c
+++ b/gcc/fortran/io.c
@@ -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
{
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index a9a0dc07e5b..bd7758b9a45 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c0f8b0dbf64..7f4f8a09941 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..c85e5be8d08
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/empty_label_typedecl.f90
@@ -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" }