PR fortran/69497
* symbol.c (gfc_symbol_done_2): Start freeing namespaces
from the root.
(gfc_free_namespace): Restore assert (revert r258839).
From-SVN: r258935
+2018-03-28 Mikael Morin <mikael@gcc.gnu.org>
+
+ PR fortran/69497
+ * symbol.c (gfc_symbol_done_2): Start freeing namespaces
+ from the root.
+ (gfc_free_namespace): Restore assert (revert r258839).
+
2018-03-28 Jakub Jelinek <jakub@redhat.com>
* gfortran.h (gfc_dt): Rename default_exp field to dec_ext.
return;
ns->refs--;
-
- if (ns->refs != 0)
+ if (ns->refs > 0)
return;
+ gcc_assert (ns->refs == 0);
+
gfc_free_statements (ns->code);
free_sym_tree (ns->sym_root);
void
gfc_symbol_done_2 (void)
{
- gfc_free_namespace (gfc_current_ns);
- gfc_current_ns = NULL;
+ if (gfc_current_ns != NULL)
+ {
+ /* free everything from the root. */
+ while (gfc_current_ns->parent != NULL)
+ gfc_current_ns = gfc_current_ns->parent;
+ gfc_free_namespace (gfc_current_ns);
+ gfc_current_ns = NULL;
+ }
gfc_free_dt_list ();
enforce_single_undo_checkpoint ();