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 tree-optimization/107505] [13 Regression] ICE: verify_flow_info failed (error: returns_twice call is not first in basic block 2)
Date: Wed, 02 Nov 2022 18:49:25 +0000	[thread overview]
Message-ID: <bug-107505-4-09vkD2pT48@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-107505-4@http.gcc.gnu.org/bugzilla/>

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

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

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

--- Comment #1 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Thanks. This is tree-ssa-sink relocating the call after 'zero' is discovered to
be const, so I think the fix may be as simple as

diff --git a/gcc/tree-ssa-sink.cc b/gcc/tree-ssa-sink.cc
index 921305201..631fc88c3 100644
--- a/gcc/tree-ssa-sink.cc
+++ b/gcc/tree-ssa-sink.cc
@@ -266,11 +266,11 @@ statement_sink_location (gimple *stmt, basic_block
frombb,
   /* We only can sink assignments and non-looping const/pure calls.  */
   int cf;
   if (!is_gimple_assign (stmt)
       && (!is_gimple_call (stmt)
          || !((cf = gimple_call_flags (stmt)) & (ECF_CONST|ECF_PURE))
-         || (cf & ECF_LOOPING_CONST_OR_PURE)))
+         || (cf & (ECF_LOOPING_CONST_OR_PURE|ECF_RETURNS_TWICE))))
     return false;

   /* We only can sink stmts with a single definition.  */
   def_p = single_ssa_def_operand (stmt, SSA_OP_ALL_DEFS);
   if (def_p == NULL_DEF_OPERAND_P)

  parent reply	other threads:[~2022-11-02 18:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  7:41 [Bug tree-optimization/107505] New: " asolokha at gmx dot com
2022-11-02 16:27 ` [Bug tree-optimization/107505] " pinskia at gcc dot gnu.org
2022-11-02 18:49 ` amonakov at gcc dot gnu.org [this message]
2022-11-05 10:49 ` rguenth at gcc dot gnu.org
2022-11-07 13:01 ` cvs-commit at gcc dot gnu.org
2022-11-07 13:03 ` amonakov 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-107505-4-09vkD2pT48@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).