https://bugs.winehq.org/show_bug.cgi?id=46662
Bug ID: 46662 Summary: absolute value of unsigned type 'unsigned int' has no effect Product: Wine Version: 4.2 Hardware: x86 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: isakov-sl@bk.ru
I compiled in macOS with clang and see numerous messages like this ~~~~ /Volumes/MacHD/Users/sergey/Documents/Projects/wine/dlls/d3d12/tests/d3d12.c:28:9: warning: taking the absolute value of unsigned type 'unsigned int' has no effect [-Wabsolute-value] if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) ^ /Volumes/MacHD/Users/sergey/Documents/Projects/wine/dlls/d3d12/tests/d3d12.c:28:9: note: remove the call to 'abs' since unsigned values cannot be negative if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) ^~~ ~~~ Let me explain it is not negligible. It is error. For example c2 = 8, c1 = 7 abs(c1 - c2) = 0xFFFFFFFF > max_diff The condition is TRUE!!!
There is other places, not only in tests, for example dlls/gdiplus/image.c and hundreds such mistakes.
https://bugs.winehq.org/show_bug.cgi?id=46662
--- Comment #1 from Sergey Isakov isakov-sl@bk.ru --- A possible solution is to cast to (int)
https://bugs.winehq.org/show_bug.cgi?id=46662
--- Comment #2 from Sergey Isakov isakov-sl@bk.ru --- It looks like fixed in new wines
https://bugs.winehq.org/show_bug.cgi?id=46662
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED
--- Comment #3 from Austin English austinenglish@gmail.com --- (In reply to Sergey Isakov from comment #2)
It looks like fixed in new wines
Fixed.
https://bugs.winehq.org/show_bug.cgi?id=46662
Nikolay Sivov bunglehead@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |d3d Fixed by SHA1| |c635f95518d50ed4e85ddf3fd4b | |283a7c6853d58
--- Comment #4 from Nikolay Sivov bunglehead@gmail.com --- Appears to be a 5 years old change. I didn't check gdiplus/image.c since there was no diff for it in the original description.
https://bugs.winehq.org/show_bug.cgi?id=46662
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #5 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 10.4.