[Bug c/87123] incorrect optimization involving INT_MIN and conditional operator

2018-08-28 Thread andy.koppe at analog dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87123 --- Comment #6 from Andy Koppe --- Thanks, consider me duly embarrased.

[Bug c/87123] incorrect optimization involving INT_MIN and conditional operator

2018-08-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87123 --- Comment #5 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #4) > Use -fsanitize=undefined to diagnose the undefined behaviour at runtime, or > use -fwrapv to make the negation well-defined (both options are suggested by > h

[Bug c/87123] incorrect optimization involving INT_MIN and conditional operator

2018-08-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87123 --- Comment #4 from Jonathan Wakely --- Use -fsanitize=undefined to diagnose the undefined behaviour at runtime, or use -fwrapv to make the negation well-defined (both options are suggested by https://gcc.gnu.org/bus/ which you were asked to read

[Bug c/87123] incorrect optimization involving INT_MIN and conditional operator

2018-08-28 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87123 Richard Biener changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/87123] incorrect optimization involving INT_MIN and conditional operator

2018-08-28 Thread andy.koppe at analog dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87123 --- Comment #2 from Andy Koppe --- You are right. The test passes when casting to unsigned before negation.

[Bug c/87123] incorrect optimization involving INT_MIN and conditional operator

2018-08-28 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87123 --- Comment #1 from Jonathan Wakely --- The result of -x cannot be represented when x==INT_MIN, it overflows which is undefined behaviour.