re PR fortran/69497 (ICE in gfc_free_namespace, at fortran/symbol.c:3701)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 25 Mar 2018 03:47:28 +0000 (03:47 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 25 Mar 2018 03:47:28 +0000 (03:47 +0000)
2018-03-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
    Dominique d'Humieres  <dominiq@gcc.gnu.org>

PR fortran/89497
* symbol.c (gfc_free_namespace): Delete the assert and only if
refs count is equals zero, free the namespace. Otherwise,
something is halfway and other errors will resound.

* gfortran.dg/pr89497.f90: New test.

Co-Authored-By: Dominique d'Humieres <dominiq@gcc.gnu.org>
From-SVN: r258839

gcc/fortran/ChangeLog
gcc/fortran/symbol.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr69497.f90 [new file with mode: 0644]

index 12348f1674d9372fc2065e01c54e9f6c9fc28eda..9ae0cc72ae943b1c4ad3542731956eec4ba8c587 100644 (file)
@@ -1,3 +1,11 @@
+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 only if
+       refs count is equals zero, free the namespace. Otherwise,
+       something is halfway and other errors will resound.
+
 2018-03-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/70068
index ce6b1e93644192a388a2bca1d21bf371e68ee02f..997d90b00fd4df7a232b8894c89a4b16b4021ea6 100644 (file)
@@ -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);
 
index 1e1f51566b84574ccc47682b9540f40c4b3650ad..1ea602938e8d3e029181f889182db70e39e90f14 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-24  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/89497
+       * gfortran.dg/pr89497.f90: New test.
+
 2018-03-24  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/70068
diff --git a/gcc/testsuite/gfortran.dg/pr69497.f90 b/gcc/testsuite/gfortran.dg/pr69497.f90
new file mode 100644 (file)
index 0000000..7b57ee1
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR89497
+program p
+   block
+   do
+   end block ! { dg-error "Expecting END DO statement" }
+end ! { dg-error "END DO statement expected" }
+! { dg-excess-errors "Unexpected end of file" }