diff options
author | Jakub Jelinek <jakub@redhat.com> | 2022-02-03 09:45:16 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2022-02-03 09:45:16 +0100 |
commit | de67f943b858099b40f73632a51e66147ec79c9b (patch) | |
tree | 9b52aaa46e288416f582859387b7d3ea46e3df2c /gcc/ggc.h | |
parent | 54d21dd5b5c5c5539505b3e037cdecb3b0ab3918 (diff) | |
download | gcc-de67f943b858099b40f73632a51e66147ec79c9b.zip gcc-de67f943b858099b40f73632a51e66147ec79c9b.tar.gz gcc-de67f943b858099b40f73632a51e66147ec79c9b.tar.bz2 |
ranger: Fix up wi_fold_in_parts for small precision types [PR104334]
The wide-int.h templates expect that when an int/long etc. operand is used
it will be sign-extended based on the types precision.
wi_fold_in_parts passes 3 such non-zero constants to wi::lt_p, wi::gt_p
and wi::eq_p - 1, 3 and 4, which means it was doing weird things if either
some of 1, 3 or 4 weren't representable in type, or if type was unsigned 3 bit
type 4 should be written as -4.
The following patch promotes the subtraction operands to widest_int and
uses that as the type for ?h_range variables and compares them as such.
We don't need the overflow handling because there is never an overflow.
2022-02-02 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/104334
* range-op.cc (range_operator::wi_fold_in_parts): Change lh_range
and rh_range type to widest_int and subtract in widest_int. Remove
ov_rh, ov_lh and sign vars, always perform comparisons as signed
and use >, < and == operators for it.
* g++.dg/opt/pr104334.C: New test.
Diffstat (limited to 'gcc/ggc.h')
0 files changed, 0 insertions, 0 deletions