[Bug c++/81928] if(!this) optimization leads to possible errors without warnings

matthieu.brucher at gmail dot com gcc-bugzilla@gcc.gnu.org
Wed Aug 23 23:59:00 GMT 2017


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

--- Comment #17 from Matthieu Brucher <matthieu.brucher at gmail dot com> ---
Not everyone runs this sanitizer, and not everyone has unit tests that can find
this error (the application I woked on that had this has numerous unit tests,
but this was not tested because the guy that wrote them forgot about this
undefined behavior or something similar).
It was discovered by chance on a product using it and tracked down.

Once again, a warning about conditions that are always true or false would
capture i, I don't know if gcc has it and if it would warn properly.


More information about the Gcc-bugs mailing list