]> git.ipfire.org Git - thirdparty/gcc.git/commit
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>
Tue, 12 Jan 2021 14:52:22 +0000 (15:52 +0100)
commit71878c08e967997b570b1acbd9ffef4234e94698
tree12d00bde9d465093463ba9ddb1997fc0d5ddd8db
parentedb7dbc25de455300ce066a2ebe728256ea46e3a
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.

(cherry picked from commit a05cc70a6c1ae0e5b22e16f4d8d13995a38ea1f9)
gcc/testsuite/gcc.dg/tree-ssa/pr98513.c [new file with mode: 0644]
gcc/value-range.cc