http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
--- Comment #3 from Dan Gohman <sunfish at google dot com> 2013-04-15 03:54:32 UTC --- Pulling the unary minus out into a separate statement, like this: uint64_t y = -x; return x <= INT64_MAX ? x : -y; causes the program to execute correctly.