This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]