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 #10 from Agner Fog <agner at agner dot org> 2011-07-25 07:43:58 UTC ---
I still think that a compiler should be predictable and consistent. It is
inconsistent that  a+5<a = false  produces a warning, while  abs(a)<0 = false
does not. Both expressions could be intended overflow checks.

Besides, some compilers produce a warning when a branch condition is always
true or always false. That is sound behavior because it is likely to be a bug.
gcc does not produce a warning when optimizing away something like  if (2+2 !=
4)


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