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/49820] Explicit check for integer negative after abs optimized away


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49820

--- Comment #12 from Agner Fog <agner at agner dot org> 2011-07-25 14:21:52 UTC ---
No the behavior is not predictable when it sometimes warns about ignoring
overflow, and sometimes not. Please add a warning when it optimizes away an
overflow check after the abs function.

Unsafe optimizations are sometimes good, sometimes causing hard-to-find bugs.
The programmer can't always predict what kind of optimizations the compiler
makes. A warning feature is the best way to enable the programmer to check if
the compiler does the right thing. The programmer can then turn off specific
warnings after verifying that the optimizations are OK.


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