https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87123
--- Comment #6 from Andy Koppe ---
Thanks, consider me duly embarrased.
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
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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87123
Richard Biener changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
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.
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.