]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/106027 - fix types in needle folding
authorRichard Biener <rguenther@suse.de>
Mon, 20 Jun 2022 11:40:50 +0000 (13:40 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 20 Jun 2022 13:01:57 +0000 (15:01 +0200)
commit713f2fd923442b1be620a44240ddf786ae0ab476
treef2b59bec9334fd4af01d51744f815282cfd353b1
parent86882d9feb6a534325d7162216696266898e36d0
middle-end/106027 - fix types in needle folding

The fold_to_nonsharp_ineq_using_bound folding ends up creating invalid
typed IL which confuses later foldings.  The following fixes that.

2022-06-20  Richard Biener  <rguenther@suse.de>

PR middle-end/106027
* fold-const.cc (fold_to_nonsharp_ineq_using_bound): Use the
type of the prevailing comparison for the new comparison type.
(fold_binary_loc): Use proper types for the A < X && A + 1 > Y
to A < X && A >= Y folding.

* gcc.dg/pr106027.c: New testcase.
gcc/fold-const.cc
gcc/testsuite/gcc.dg/pr106027.c [new file with mode: 0644]