https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753
--- Comment #6 from Łukasz Spintzyk ---
I confirm changing the code to use unsigned int fixed the problem.
Also there is no signed overflow errors.
Thanks a lot.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753
--- Comment #5 from Marc Glisse ---
(In reply to Łukasz Spintzyk from comment #4)
> Looking from this point of view is this really invalid?
There is a perfectly valid way to write such code:
"You need to use an unsigned type for this type of co
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753
--- Comment #4 from Łukasz Spintzyk ---
Yes, this code is utilizing overflow, but it is there for a reason to optimize
the code and get rid of branches as they can slow down program execution.
You can refer to http://locklessinc.com/articles/sat
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753
Andrew Pinski changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753
--- Comment #2 from Marc Glisse ---
-fsanitize=undefined
a.c:11:21: runtime error: signed integer overflow: 260 + 2147483392 cannot be
represented in type 'int'
You need to use an unsigned type for this type of computation.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71753
--- Comment #1 from Andrew Pinski ---
Comment on attachment 38830
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38830
Code that reproduces the issue
value + 0x7F00
Will overflow most of the time.