public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pault at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/106050] ICE in reject_statement, at fortran/parse.cc:2879 since r8-3056-g5bab4c9631c478b7
Date: Tue, 11 Jul 2023 11:43:05 +0000	[thread overview]
Message-ID: <bug-106050-4-0NVHscXntp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106050-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106050

--- Comment #7 from Paul Thomas <pault at gcc dot gnu.org> ---
(In reply to Mikael Morin from comment #6)
> (In reply to Mikael Morin from comment #5)
> > Possibly walking the symbols in reverse order to release them would fix this.
> > 
> It seems to work:
> 
> diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
> index 37a9e8fa0ae..4a71d84b3fe 100644
> --- a/gcc/fortran/symbol.cc
> +++ b/gcc/fortran/symbol.cc
> @@ -3661,7 +3661,7 @@ gfc_restore_last_undo_checkpoint (void)
>    gfc_symbol *p;
>    unsigned i;
>  
> -  FOR_EACH_VEC_ELT (latest_undo_chgset->syms, i, p)
> +  FOR_EACH_VEC_ELT_REVERSE (latest_undo_chgset->syms, i, p)
>      {
>        /* Symbol in a common block was new. Or was old and just put in
> common */
>        if (p->common_block

So does this:

diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc
index 37a9e8fa0ae..ada8cb2ba83 100644
--- a/gcc/fortran/symbol.cc
+++ b/gcc/fortran/symbol.cc
@@ -3703,6 +3703,10 @@ gfc_restore_last_undo_checkpoint (void)
            }
          p->common_next = NULL;
        }
+
+      if (!strlen(p->name))
+       continue;
+
       if (p->gfc_new)
        {
          /* The derived type is saved in the symtree with the first

I think that yours is likely to be better though. Have you understood why the
symbol order matters in this case?

BTW pr99798 is another ref counting ICE; this time involving namespaces.

Paul

  parent reply	other threads:[~2023-07-11 11:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-21 18:53 [Bug fortran/106050] New: ICE in reject_statement, at fortran/parse.cc:2879 gscfq@t-online.de
2022-06-21 20:47 ` [Bug fortran/106050] " kargl at gcc dot gnu.org
2022-06-27  8:48 ` [Bug fortran/106050] ICE in reject_statement, at fortran/parse.cc:2879 since r8-3056-g5bab4c9631c478b7 marxin at gcc dot gnu.org
2023-06-06 19:18 ` kargl at gcc dot gnu.org
2023-07-10 16:20 ` pault at gcc dot gnu.org
2023-07-10 16:29 ` pault at gcc dot gnu.org
2023-07-10 18:15 ` mikael at gcc dot gnu.org
2023-07-11 11:24 ` mikael at gcc dot gnu.org
2023-07-11 11:43 ` pault at gcc dot gnu.org [this message]
2023-07-13 19:24 ` cvs-commit at gcc dot gnu.org
2023-09-12  8:36 ` mikael at gcc dot gnu.org
2023-09-15 17:24 ` mikael 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-106050-4-0NVHscXntp@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: link
Be 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).