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)