[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

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Dec 12 17:12:39 GMT 2021


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


More information about the Gcc-bugs mailing list