[Bug sanitizer/95279] UBSan doesn't seem to detect pointer overflow in certain cases

glisse at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon May 25 13:31:50 GMT 2020


--- Comment #12 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #10)
> 1 + (size_t) -1 give 0

It wasn't obvious to me that the operation was supposed to happen in some C/C++
type (they don't say which one) or in a mathematical, infinite-precision sense.
After all, they write 0≤i−j≤n which shouldn't be interpreted as C++ code. But
you have more experience with reading these things, I believe you.

More information about the Gcc-bugs mailing list