public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amonakov at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/101347] [11/12/13 Regression] ICE in cfg_layout_initialize with __builtin_setjmp and -fprofile-generate -fprofile-use
Date: Thu, 14 Jul 2022 18:15:21 +0000	[thread overview]
Message-ID: <bug-101347-4-JW427q70jt@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101347-4@http.gcc.gnu.org/bugzilla/>

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

Alexander Monakov <amonakov at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |amonakov at gcc dot gnu.org

--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
The label at __builtin_setjmp_receiver was added to
nonlocal_goto_handler_labels twice (because __builtin_setjmp_setup was
duplicated), but remove_node_from_insn_list removed only the first copy. A
simple check would have caught this early:

@@ -2928,6 +2899,7 @@ remove_node_from_insn_list (const rtx_insn *node,
rtx_insn_list **listp)
          else
            *listp = temp->next ();

+         gcc_checking_assert (!in_insn_list_p (temp->next (), node));
          return;
        }


I think a reasonable solution is to move registration of receiver label from
expansion of __builtin_setjmp_setup to expansion of __builtin_setjmp_receiver:

@@ -7467,15 +7467,7 @@ expand_builtin (tree exp, rtx target, rtx subtarget,
machine_mode mode,
          tree label = TREE_OPERAND (CALL_EXPR_ARG (exp, 1), 0);
          rtx_insn *label_r = label_rtx (label);

-         /* This is copied from the handling of non-local gotos.  */
          expand_builtin_setjmp_setup (buf_addr, label_r);
-         nonlocal_goto_handler_labels
-           = gen_rtx_INSN_LIST (VOIDmode, label_r,
-                                nonlocal_goto_handler_labels);
-         /* ??? Do not let expand_label treat us as such since we would
-            not want to be both on the list of non-local labels and on
-            the list of forced labels.  */
-         FORCED_LABEL (label) = 0;
          return const0_rtx;
        }
       break;
@@ -7488,6 +7480,13 @@ expand_builtin (tree exp, rtx target, rtx subtarget,
machine_mode mode,
          rtx_insn *label_r = label_rtx (label);

          expand_builtin_setjmp_receiver (label_r);
+         nonlocal_goto_handler_labels
+           = gen_rtx_INSN_LIST (VOIDmode, label_r,
+                                nonlocal_goto_handler_labels);
+         /* ??? Do not let expand_label treat us as such since we would
+            not want to be both on the list of non-local labels and on
+            the list of forced labels.  */
+         FORCED_LABEL (label) = 0;
          return const0_rtx;
        }
       break;

  parent reply	other threads:[~2022-07-14 18:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-06 17:29 [Bug c/101347] New: [11/12 Regression] ICE in cfg_layout_initialize, at cfgrtl.c:4478 gscfq@t-online.de
2021-07-06 19:20 ` [Bug rtl-optimization/101347] [11/12 Regression] ICE in cfg_layout_initialize with __builtin_setjmp and -fprofile-generate -fprofile-use pinskia at gcc dot gnu.org
2021-07-07  6:38 ` rguenth at gcc dot gnu.org
2021-07-07  6:38 ` rguenth at gcc dot gnu.org
2021-07-28  7:07 ` rguenth at gcc dot gnu.org
2022-04-21  7:49 ` rguenth at gcc dot gnu.org
2022-07-14 18:15 ` amonakov at gcc dot gnu.org [this message]
2022-07-20 13:12 ` [Bug rtl-optimization/101347] [11/12/13 " cvs-commit at gcc dot gnu.org
2022-07-20 13:15 ` [Bug rtl-optimization/101347] [11/12 " amonakov at gcc dot gnu.org
2022-07-27  7:18 ` rguenth 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-101347-4-JW427q70jt@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).