From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15713 invoked by alias); 7 Jan 2008 22:58:22 -0000 Received: (qmail 15561 invoked by uid 48); 7 Jan 2008 22:57:39 -0000 Date: Mon, 07 Jan 2008 23:47:00 -0000 Message-ID: <20080107225739.15560.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/33375] ICE (segfault) gfortran.dg/common_6.f90 In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "hjl at lucon dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-01/txt/msg00677.txt.bz2 ------- Comment #9 from hjl at lucon dot org 2008-01-07 22:57 ------- We are processing common block symbols which we have rejected/freed before. This patch works for me: Index: symbol.c =================================================================== --- symbol.c (revision 131352) +++ symbol.c (working copy) @@ -2726,14 +2726,14 @@ gfc_commit_symbol (gfc_symbol *sym) /* Recursive function that deletes an entire tree and all the common head structures it points to. */ -static void -free_common_tree (gfc_symtree * common_tree) +void +gfc_free_common_tree (gfc_symtree * common_tree) { if (common_tree == NULL) return; - free_common_tree (common_tree->left); - free_common_tree (common_tree->right); + gfc_free_common_tree (common_tree->left); + gfc_free_common_tree (common_tree->right); gfc_free (common_tree); } @@ -2863,7 +2863,7 @@ gfc_free_namespace (gfc_namespace *ns) free_sym_tree (ns->sym_root); free_uop_tree (ns->uop_root); - free_common_tree (ns->common_root); + gfc_free_common_tree (ns->common_root); for (cl = ns->cl_list; cl; cl = cl2) { Index: gfortran.h =================================================================== --- gfortran.h (revision 131352) +++ gfortran.h (working copy) @@ -2137,6 +2137,7 @@ int gfc_symbols_could_alias (gfc_symbol void gfc_undo_symbols (void); void gfc_commit_symbols (void); void gfc_commit_symbol (gfc_symbol *); +void gfc_free_common_tree (gfc_symtree *); void gfc_free_namespace (gfc_namespace *); void gfc_symbol_init_2 (void); Index: match.c =================================================================== --- match.c (revision 131352) +++ match.c (working copy) @@ -2956,6 +2956,8 @@ done: return MATCH_YES; syntax: + gfc_free_common_tree (gfc_current_ns->common_root); + gfc_current_ns->common_root = NULL; gfc_syntax_error (ST_COMMON); cleanup: I don't know if it is 100% correct. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33375