+2014-12-15 Steven Bosscher <steven@gcc.gnu.org>
+
+ PR fortran/61669
+ * gfortran.h (struct gfc_namespace): Add OLD_DATA field.
+ * decl.c (gfc_reject_data): New function.
+ * parse.c *use_modules): Record roll-back point.
+ (next_statement): Likewise.
+ (reject_statement): Roll back to last accepted DATA.
+
2014-12-15 Janus Weil <janus@gcc.gnu.org>
PR fortran/63727
}
}
+/* Reject data parsed since the last restore point was marked. */
+
+void
+gfc_reject_data (gfc_namespace *ns)
+{
+ gfc_data *d;
+
+ while (ns->data && ns->data != ns->old_data)
+ {
+ d = ns->data->next;
+ free (ns->data);
+ ns->data = d;
+ }
+}
static match var_element (gfc_data_variable *);
gfc_st_label *st_labels;
/* This list holds information about all the data initializers in
this namespace. */
- struct gfc_data *data;
+ struct gfc_data *data, *old_data;
gfc_charlen *cl_list, *old_cl_list;
void gfc_free_equiv (gfc_equiv *);
void gfc_free_equiv_until (gfc_equiv *, gfc_equiv *);
void gfc_free_data (gfc_data *);
+void gfc_reject_data (gfc_namespace *);
void gfc_free_case_list (gfc_case *);
/* matchexp.c -- FIXME too? */
gfc_warning_check ();
gfc_current_ns->old_cl_list = gfc_current_ns->cl_list;
gfc_current_ns->old_equiv = gfc_current_ns->equiv;
+ gfc_current_ns->old_data = gfc_current_ns->data;
last_was_use_stmt = false;
}
gfc_current_ns->old_cl_list = gfc_current_ns->cl_list;
gfc_current_ns->old_equiv = gfc_current_ns->equiv;
+ gfc_current_ns->old_data = gfc_current_ns->data;
for (;;)
{
gfc_statement_label = NULL;
gfc_free_equiv_until (gfc_current_ns->equiv, gfc_current_ns->old_equiv);
gfc_current_ns->equiv = gfc_current_ns->old_equiv;
+ gfc_reject_data (gfc_current_ns);
+
gfc_new_block = NULL;
gfc_undo_symbols ();
gfc_clear_warning ();
+2014-12-15 Steven Bosscher <steven@gcc.gnu.org>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR fortran/61669
+ * gfortran.dg/pr61669.f90: New test.
+
2014-12-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/64312
--- /dev/null
+! { dg-do compile }
+ write (*,"(a)") char(12)
+ CHARACTER*80 A /"A"/ ! { dg-error "Unexpected data declaration statement" }
+ REAL*4 B ! { dg-error "Unexpected data declaration statement" }
+ write (*,"(a)") char(12)
+ DATA B / 0.02 / ! { dg-warning "Obsolescent feature: DATA statement" }
+ END