This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, fortran] PR17741 - ICE in gfc_free_namespace, at fortran/symbol.c:2208
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: fortran at gcc dot gnu dot org, patch <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 11 May 2006 21:56:46 +0200
- Subject: [Patch, fortran] PR17741 - ICE in gfc_free_namespace, at fortran/symbol.c:2208
:ADDPATCH fortran:
This is very bad and ICEs
subroutine FOO
interface
integer function BAR()
end subroutine
However, I think that it is not correct to emit an ICE on this one. The
patch below emits an error and bails out. I do not think that it merits
a testcase as it must be rather rare and is not going to break itself.
Regtested on Cygwin_NT/PIV. OK for trunk and 4.1?
Paul
2005-05-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/17741
* symbol.c(gfc_free_namespace): If the number of refs is
zero or less, emit an error and return instead of ICEing.
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (r├®vision 113111)
+++ gcc/fortran/symbol.c (copie de travail)
@@ -2490,8 +2490,15 @@
ns->refs--;
if (ns->refs > 0)
return;
- gcc_assert (ns->refs == 0);
+ if (ns->refs != 0)
+ {
+ gfc_error_now ("namespace %s has %d references on being freed",
+ ns->proc_name->name ? ns->proc_name->name : "MAIN",
+ ns->refs + 1);
+ return;
+ }
+
gfc_free_statements (ns->code);
free_sym_tree (ns->sym_root);