[patch,fortran] Bug 69497 - ICE in gfc_free_namespace

Jerry DeLisle jvdelisle@charter.net
Sat Mar 24 21:56:00 GMT 2018


This one has been hanging around for a while. Dominique found this fix.

I retested with the 30 cases provided in the PR. These are all invalid 
fortran. They give errors now and do not ICE.

Regression tested on trunk.

OK?

Jerry

PS I will use the first of the many test cases for the testsuite with 
appropriate ChangeLog, etc.

2018-03-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
	    Dominique d'Humieres  <dominiq@gcc.gnu.org>

	PR fortran/84506
	* symbol.c (gfc_free_namespace): Delete the assert and if refs
	count is less than zero, free the namespece. Something is
	halfway	and other errors will resound.

diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index ce6b1e93644..997d90b00fd 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -4037,10 +4037,9 @@ gfc_free_namespace (gfc_namespace *ns)
      return;

    ns->refs--;
-  if (ns->refs > 0)
-    return;

-  gcc_assert (ns->refs == 0);
+  if (ns->refs != 0)
+    return;

    gfc_free_statements (ns->code);



More information about the Gcc-patches mailing list