From 8954606d17ebf8b6f26e856a9def11a4c674cb1b Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Sun, 25 Mar 2018 03:47:28 +0000 Subject: [PATCH] re PR fortran/69497 (ICE in gfc_free_namespace, at fortran/symbol.c:3701) 2018-03-24 Jerry DeLisle Dominique d'Humieres 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 From-SVN: r258839 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/symbol.c | 5 ++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr69497.f90 | 8 ++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/pr69497.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 12348f1674d..9ae0cc72ae9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2018-03-24 Jerry DeLisle + Dominique d'Humieres + + 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 PR fortran/70068 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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e1f51566b8..1ea602938e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-24 Jerry DeLisle + + PR fortran/89497 + * gfortran.dg/pr89497.f90: New test. + 2018-03-24 Thomas Koenig PR fortran/70068 diff --git a/gcc/testsuite/gfortran.dg/pr69497.f90 b/gcc/testsuite/gfortran.dg/pr69497.f90 new file mode 100644 index 00000000000..7b57ee13368 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr69497.f90 @@ -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" } -- 2.30.2