public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jvdelisle at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/103506] [10/11/12/13 Regression] ICE in gfc_free_namespace, at fortran/symbol.c:4039 since r10-2798-ge68a35ae4a65d2b3 Date: Thu, 26 Jan 2023 02:56:02 +0000 [thread overview] Message-ID: <bug-103506-4-Bs4jn4W8XZ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103506-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103506 --- Comment #5 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> --- I found that the attached patch does not work. At the point of assertion many of the other functions to free memory have null pointers which leads to segfaults all along the way. The following approach appears to work, however, obviously there is a lot of memory left not freed, so we would rely on the OS to clean it up. Maybe this is ok, not sure. +++ b/gcc/fortran/symbol.cc @@ -4032,7 +4032,7 @@ void gfc_free_namespace (gfc_namespace *&ns) { gfc_namespace *p, *q; - int i; + int i, ecnt; gfc_was_finalized *f; if (ns == NULL) @@ -4042,6 +4042,12 @@ gfc_free_namespace (gfc_namespace *&ns) if (ns->refs > 0) return; + /* In the presence of errors, the namespace may be + corrupted or non-sense. Don't assert() and bail out. */ + gfc_get_errors (NULL, &ecnt); + if (ecnt > 0) + return; + gcc_assert (ns->refs == 0); gfc_free_statements (ns->code);
next prev parent reply other threads:[~2023-01-26 2:56 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-30 18:49 [Bug fortran/103506] New: [10/11/12 Regression] ICE in gfc_free_namespace, at fortran/symbol.c:4039 gscfq@t-online.de 2021-12-01 7:17 ` [Bug fortran/103506] " rguenth at gcc dot gnu.org 2021-12-01 9:28 ` [Bug fortran/103506] [10/11/12 Regression] ICE in gfc_free_namespace, at fortran/symbol.c:4039 since r10-2798-ge68a35ae4a65d2b3 marxin at gcc dot gnu.org 2021-12-22 23:52 ` kargl at gcc dot gnu.org 2022-06-28 10:47 ` [Bug fortran/103506] [10/11/12/13 " jakub at gcc dot gnu.org 2022-06-28 14:59 ` kargl at gcc dot gnu.org 2023-01-26 2:56 ` jvdelisle at gcc dot gnu.org [this message] 2023-01-26 18:29 ` sgk at troutmask dot apl.washington.edu 2023-01-27 2:06 ` jvdelisle at gcc dot gnu.org 2023-01-27 2:11 ` jvdelisle at gcc dot gnu.org 2023-01-27 2:14 ` jvdelisle at gcc dot gnu.org 2023-01-27 17:28 ` sgk at troutmask dot apl.washington.edu 2023-01-27 21:33 ` anlauf at gcc dot gnu.org 2023-01-27 21:52 ` tkoenig at gcc dot gnu.org 2023-01-28 0:59 ` jvdelisle at gcc dot gnu.org 2023-01-29 3:08 ` jvdelisle at gcc dot gnu.org 2023-01-29 19:10 ` cvs-commit at gcc dot gnu.org 2023-03-22 18:18 ` [Bug fortran/103506] [10/11/12 " anlauf at gcc dot gnu.org 2023-03-27 1:17 ` cvs-commit at gcc dot gnu.org 2023-07-07 10:41 ` [Bug fortran/103506] [11/12 " rguenth at gcc dot gnu.org 2023-07-08 19:43 ` [Bug fortran/103506] [11 " anlauf at gcc dot gnu.org 2023-08-05 23:44 ` cvs-commit at gcc dot gnu.org 2023-08-05 23:45 ` jvdelisle at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-103506-4-Bs4jn4W8XZ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).