PR82547: Undetected overflow for UNSIGNED wide_ints
commit2061c393bcf4d693ff1967172009384edf8300ca
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Nov 2017 13:58:57 +0000 (22 13:58 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 Nov 2017 13:58:57 +0000 (22 13:58 +0000)
treedde1145642e089c705eba8a6de288f81437c2a6a
parentd120080e29df3a45b14ba5d2566464f438be1103
PR82547: Undetected overflow for UNSIGNED wide_ints

wi::add_large and wi::sub_large weren't setting the overflow bit
correctly for unsigned operations if the result needed fewer HWIs
than the precision.

2017-11-22  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
PR middle-end/82547
* wide-int.cc (wi::add_large, wi::sub_large): Fix overflow detection
for unsigned values with fewer HWIs than the precision.
(test_overflow): New function.
(wide_int_cc_tests): Call it.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255059 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/wide-int.cc