x86_64-w64-mingw32-gcc throws following -Wsign-compare warning when
compiling 64-bit NT kernel drivers which include ddk/ntddk.h file:

  ddk/wdm.h: In function ‘RtlExtendedMagicDivide’:
  ddk/wdm.h:9531:32: warning: operand of ?: changes signedness from ‘long long 
int’ to ‘ULONG64’ {aka ‘long long unsigned int’} due to unsignedness of other 
operand [-Wsign-compare]
     ret.QuadPart = Pos ? ret64 : -(LONG64)ret64;
                                  ^~~~~~~~~~~~~~
Member ret.QuadPart is of type LONGLONG, so explicitly cast both parts of
ret64 ternary operator to LONG64.
---
 mingw-w64-headers/ddk/include/ddk/wdm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mingw-w64-headers/ddk/include/ddk/wdm.h 
b/mingw-w64-headers/ddk/include/ddk/wdm.h
index 64bcbc5c74b5..c2c547730b39 100644
--- a/mingw-w64-headers/ddk/include/ddk/wdm.h
+++ b/mingw-w64-headers/ddk/include/ddk/wdm.h
@@ -9528,7 +9528,7 @@ RtlExtendedMagicDivide(
   ret64 = UnsignedMultiplyHigh(Pos ? Dividend.QuadPart : -Dividend.QuadPart,
                                MagicDivisor.QuadPart);
   ret64 >>= ShiftCount;
-  ret.QuadPart = Pos ? ret64 : -(LONG64)ret64;
+  ret.QuadPart = Pos ? (LONG64)ret64 : -(LONG64)ret64;
   return ret;
 }
 #endif
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to