[Bug middle-end/82547] wide_int is not setting overflow properly for large unsigned add/subtract calculations.

rsandifo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 22 13:59:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82547

--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Author: rsandifo
Date: Wed Nov 22 13:58:57 2017
New Revision: 255059

URL: https://gcc.gnu.org/viewcvs?rev=255059&root=gcc&view=rev
Log:
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.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/wide-int.cc


More information about the Gcc-bugs mailing list