This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, Fortran, committed] PR54462 - fix ICE on invalid
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Wed, 05 Sep 2012 18:58:23 +0200
- Subject: [Patch, Fortran, committed] PR54462 - fix ICE on invalid
Rather obvious fix. gfc_undo_symbols segfaulted when the COMMON
statement aborted before the common symtree was created. Committed as
Rev. 190989.
Hopefully, that's the last fall out of my memory clean up patch.
The hopefully last issue with the current FINAL patch has already been
fixed by Mikael. Thanks!
Tobias
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog (Revision 190985)
+++ gcc/fortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,8 @@
+2012-09-04 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/54462
+ * symbol.c (gfc_undo_symbols): Avoid NULL pointer dereference.
+
2012-09-04 Janus Weil <janus@gcc.gnu.org>
PR fortran/54435
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (Revision 190985)
+++ gcc/fortran/symbol.c (Arbeitskopie)
@@ -2919,10 +2919,12 @@ gfc_undo_symbols (void)
gfc_symtree st, *st0;
st0 = find_common_symtree (p->ns->common_root,
p->common_block);
-
- st.name = st0->name;
- gfc_delete_bbt (&p->ns->common_root, &st, compare_symtree);
- free (st0);
+ if (st0)
+ {
+ st.name = st0->name;
+ gfc_delete_bbt (&p->ns->common_root, &st, compare_symtree);
+ free (st0);
+ }
}
if (p->common_block->head == p)