[Bug sanitizer/82072] sanitizer does not detect an overflow from LLONG_MIN

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 1 14:22:00 GMT 2017


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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-09-01
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

We have
i = i - lmin
where i is int and lmin is long int, so what we should produce is
i = (int) ((long int) i - lmin)
but instead we produce
i = (int) ((unsigned int) i - (unsigned int) lmin);

This is do_narrow at work.


More information about the Gcc-bugs mailing list