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.
This commit is contained in:
Jan Hubicka 2021-12-13 09:38:53 +01:00
parent 01ad8c54fd
commit 3b61f06b2e
2 changed files with 9 additions and 1 deletions

View 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;
}

View File

@ -0,0 +1,8 @@
int a;
void b(int c) {
int d = 3;
d ^= c < 2;
if (d < 3 && a)
while (1)
b(!a);
}