https://gcc.gnu.org/bugzilla/show_bug.cgi?id=30475
Marian <marian.buschsieweke at ovgu dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marian.buschsieweke at ovgu dot de --- Comment #57 from Marian <marian.buschsieweke at ovgu dot de> --- Sorry for posting to this ancient bugreport. Is there a way to get a warning when code get optimized out based on undefined behavior? I bet that at least 90% of the C developers out there would be completely surprised that signed integer overflow is actually undefined behavior. And at least 99% of the C developers out there would not spot the bug in http://ptrace.fefe.de/int.c spending significant time and energy. So being able to get a warning for that would be highly appreciated tool to help finding and fixing those bugs. Kind regards, Marian PS: Please also consider to enable this warning with `-Wall -Wextra -pedantic`. I bet that 99% of the cases the compiler can optimize code out because of this undefined behavior the code has a bug in some bound checks.