public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-5921] Do not ICE on ternary expressions when calculating value ranges
Date: Mon, 13 Dec 2021 08:39:27 +0000 (GMT)	[thread overview]
Message-ID: <20211213083927.720353858409@sourceware.org> (raw)

https://gcc.gnu.org/g:3b61f06b2e1e7e72fcb6c0cf3590cb25eb92c4f2

commit r12-5921-g3b61f06b2e1e7e72fcb6c0cf3590cb25eb92c4f2
Author: Jan Hubicka <jh@suse.cz>
Date:   Mon Dec 13 09:38:53 2021 +0100

    Do not ICE on ternary expressions when calculating value ranges
    
    gcc/ChangeLog:
    
    2021-12-12  Jan Hubicka  <hubicka@ucw.cz>
    
            PR ipa/103513
            * 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>
    
            PR ipa/103513
            * gcc.c-torture/compile/pr103513.c: New test.

Diff:
---
 gcc/ipa-fnsummary.c                            | 2 +-
 gcc/testsuite/gcc.c-torture/compile/pr103513.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

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);
+}


                 reply	other threads:[~2021-12-13  8:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20211213083927.720353858409@sourceware.org \
    --to=hubicka@gcc.gnu.org \
    --cc=gcc-cvs@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).