public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug ipa/103513] [12 Regression] ICE in evaluate_conditions_for_known_args, at ipa-fnsummary.c:516 with -O2 and above since r12-5531-g1b0acc4b800b589a
Date: Sun, 12 Dec 2021 17:12:39 +0000	[thread overview]
Message-ID: <bug-103513-4-tQn2tPc4rL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-103513-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK, i suppose we do not really have interface to fold ternary expression? It
could still do useful work merging the value ranges of both arms...

I am testing the following:
gcc/ChangeLog:

2021-12-12  Jan Hubicka  <hubicka@ucw.cz>

        * ipa-fnsummary.c (evaluate_conditions_for_known_args): Do not ICE
        on ternary expression.

gcc/testsuite/ChangeLog:

2021-12-12  Jan Hubicka  <hubicka@ucw.cz>

        * gcc.c-torture/compile/pr103513.c: New test.

diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c
index 6c1cdf17e47..cb3c198ec0c 100644
--- a/gcc/ipa-fnsummary.c
+++ b/gcc/ipa-fnsummary.c
@@ -513,7 +513,7 @@ evaluate_conditions_for_known_args (struct cgraph_node
*node,
                                              op->index ? &vr : &op0);
                    }
                  else
-                   gcc_unreachable ();
+                   res.set_varying (op->type);
                  type = op->type;
                  vr = res;
                }
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr103513.c
b/gcc/testsuite/gcc.c-torture/compile/pr103513.c
new file mode 100644
index 00000000000..ca876a9816c
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr103513.c
@@ -0,0 +1,8 @@
+int a;
+void b(int c) {
+  int d = 3;
+  d ^= c < 2;
+  if (d < 3 && a)
+    while (1)
+      b(!a);
+}

  parent reply	other threads:[~2021-12-12 17:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01  6:24 [Bug ipa/103513] New: [12 Regression] ICE in evaluate_conditions_for_known_args, at ipa-fnsummary.c:516 with -O2 and above haoxintu at gmail dot com
2021-12-01  6:25 ` [Bug ipa/103513] " pinskia at gcc dot gnu.org
2021-12-01  6:31 ` pinskia at gcc dot gnu.org
2021-12-01  7:24 ` rguenth at gcc dot gnu.org
2021-12-01  7:36 ` pinskia at gcc dot gnu.org
2021-12-01  9:23 ` [Bug ipa/103513] [12 Regression] ICE in evaluate_conditions_for_known_args, at ipa-fnsummary.c:516 with -O2 and above since r12-5531-g1b0acc4b800b589a marxin at gcc dot gnu.org
2021-12-01 20:34 ` dcb314 at hotmail dot com
2021-12-09 20:55 ` zhendong.su at inf dot ethz.ch
2021-12-12 17:12 ` hubicka at gcc dot gnu.org [this message]
2021-12-13  8:39 ` cvs-commit at gcc dot gnu.org
2021-12-13  8:41 ` hubicka 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-103513-4-tQn2tPc4rL@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).