From: Jan Hubicka Date: Mon, 13 Dec 2021 08:38:53 +0000 (+0100) Subject: Do not ICE on ternary expressions when calculating value ranges X-Git-Tag: basepoints/gcc-13~2392 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b61f06b2e1e7e72fcb6c0cf3590cb25eb92c4f2;p=thirdparty%2Fgcc.git Do not ICE on ternary expressions when calculating value ranges gcc/ChangeLog: 2021-12-12 Jan Hubicka 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 PR ipa/103513 * gcc.c-torture/compile/pr103513.c: New test. --- diff --git a/gcc/ipa-fnsummary.c b/gcc/ipa-fnsummary.c index 6c1cdf17e47b..cb3c198ec0cc 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 000000000000..ca876a9816c3 --- /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); +}