[Mlir-commits] [mlir] 0fd9580 - [mlir] fix -Wsign-compare equivalent on Windows

Alex Zinenko llvmlistbot at llvm.org
Tue Aug 30 13:56:42 PDT 2022


Author: Alex Zinenko
Date: 2022-08-30T22:56:31+02:00
New Revision: 0fd95808650aa2addc851ba66a6fc00a83f3f28f

URL: https://github.com/llvm/llvm-project/commit/0fd95808650aa2addc851ba66a6fc00a83f3f28f
DIFF: https://github.com/llvm/llvm-project/commit/0fd95808650aa2addc851ba66a6fc00a83f3f28f.diff

LOG: [mlir] fix -Wsign-compare equivalent on Windows

Some clients treat this as compilation error.

Added: 
    

Modified: 
    mlir/lib/AsmParser/AttributeParser.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/AsmParser/AttributeParser.cpp b/mlir/lib/AsmParser/AttributeParser.cpp
index f4077a50b805..27a870d9627e 100644
--- a/mlir/lib/AsmParser/AttributeParser.cpp
+++ b/mlir/lib/AsmParser/AttributeParser.cpp
@@ -1177,7 +1177,8 @@ Attribute Parser::parseStridedLayoutAttr() {
 
     if (getToken().is(Token::integer)) {
       Optional<uint64_t> value = getToken().getUInt64IntegerValue();
-      if (!value || *value > std::numeric_limits<int64_t>::max())
+      if (!value ||
+          *value > static_cast<uint64_t>(std::numeric_limits<int64_t>::max()))
         return emitWrongTokenError();
       consumeToken();
       return static_cast<int64_t>(*value);


        


More information about the Mlir-commits mailing list