tree-optimization/98513 - fix bug in range intersection code
authorRichard Biener <rguenther@suse.de>
Wed, 6 Jan 2021 08:26:55 +0000 (09:26 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 6 Jan 2021 08:33:37 +0000 (09:33 +0100)
commita05cc70a6c1ae0e5b22e16f4d8d13995a38ea1f9
tree4bf3a143b16e38f1dcb6d6b8cc72ece392047926
parent57706dd7e001d8302b596521217827855324e748
tree-optimization/98513 - fix bug in range intersection code

This fixes a premature optimization in the range intersection code
which assumes earlier branches have to be taken, not taking into
account that for symbolic ranges we cannot always compare endpoints.
The fix is to instantiate the compare deemed redundant (which then
fails as undecidable for the testcase).

2021-01-06  Richard Biener  <rguenther@suse.de>

PR tree-optimization/98513
* value-range.cc (intersect_ranges): Compare the upper bounds
for the expected relation.

* gcc.dg/tree-ssa/pr98513.c: New testcase.
gcc/testsuite/gcc.dg/tree-ssa/pr98513.c [new file with mode: 0644]
gcc/value-range.cc