public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5921] Do not ICE on ternary expressions when calculating value ranges
@ 2021-12-13  8:39 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2021-12-13  8:39 UTC (permalink / raw)
  To: gcc-cvs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-13  8:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13  8:39 [gcc r12-5921] Do not ICE on ternary expressions when calculating value ranges Jan Hubicka

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).