https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
--- Comment #8 from Richard Biener ---
Yeah, unfortunately that doesn't look correct :(
I've always wanted to have an ABS_EXPR variant that returns an unsigned value
(so with no undefined behavior). Maybe just overload ABS_EXPR in this way.
You
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
Marek Polacek changed:
What|Removed |Added
Status|UNCONFIRMED |NEW
Last reconfirmed|
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
--- Comment #6 from Dan Gohman 2013-04-15 05:14:27
UTC ---
(In reply to comment #3)
> Pulling the unary minus out into a separate statement, like this:
>
> uint64_t y = -x;
> return x <= INT64_MAX ? x : -y;
>
> causes the program
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
--- Comment #5 from Dan Gohman 2013-04-15 05:12:30
UTC ---
(In reply to comment #4)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > I think 'x' can not present negative value.
> >
> > The unary minus operator is defined for unsign
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
--- Comment #4 from Chung-Ju Wu 2013-04-15
04:18:13 UTC ---
(In reply to comment #2)
> (In reply to comment #1)
> > I think 'x' can not present negative value.
>
> The unary minus operator is defined for unsigned types. It doesn't produ
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
--- Comment #3 from Dan Gohman 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.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
--- Comment #2 from Dan Gohman 2013-04-15 03:53:10
UTC ---
(In reply to comment #1)
> I think 'x' can not present negative value.
The unary minus operator is defined for unsigned types. It doesn't produce
signed overflow.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56956
Chung-Ju Wu changed:
What|Removed |Added
CC||jasonwucj at gmail dot com
--- Co