]> gcc.gnu.org Git - gcc.git/commitdiff
Do not ICE on ternary expressions when calculating value ranges
authorJan Hubicka <jh@suse.cz>
Mon, 13 Dec 2021 08:38:53 +0000 (09:38 +0100)
committerJan Hubicka <jh@suse.cz>
Mon, 13 Dec 2021 08:38:53 +0000 (09:38 +0100)
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.

gcc/ipa-fnsummary.c
gcc/testsuite/gcc.c-torture/compile/pr103513.c [new file with mode: 0644]

index 6c1cdf17e47b7c75da47a7138e6ef463beae5771..cb3c198ec0ccd8e35ad167bc9a8f92671e133200 100644 (file)
@@ -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 (file)
index 0000000..ca876a9
--- /dev/null
@@ -0,0 +1,8 @@
+int a;
+void b(int c) {
+  int d = 3;
+  d ^= c < 2;
+  if (d < 3 && a)
+    while (1)
+      b(!a);
+}
This page took 0.071808 seconds and 5 git commands to generate.