re PR fortran/69497 (ICE in gfc_free_namespace, at fortran/symbol.c:3701)

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
This commit is contained in:
Mikael Morin 2018-03-28 20:12:55 +00:00
parent e8b8462de6
commit 9b0588e936
2 changed files with 18 additions and 4 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -4037,10 +4037,11 @@ gfc_free_namespace (gfc_namespace *ns)
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);
@ -4087,8 +4088,14 @@ gfc_symbol_init_2 (void)
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 ();