[Mlir-commits] [mlir] ab80ad0 - [mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t' error (NFC)

Jie Fu llvmlistbot at llvm.org
Thu May 25 19:03:15 PDT 2023


Author: Jie Fu
Date: 2023-05-26T10:02:21+08:00
New Revision: ab80ad0095083fda062c23ac90df84c40b4332c8

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

LOG: [mlir] Fix non-const lvalue reference to type 'uint64_t' cannot bind to type 'size_t' error (NFC)

/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1007:39: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
    if (failed(propReader.parseVarInt(count)))
                                      ^~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:191:39: note: passing argument to parameter 'result' here
  LogicalResult parseVarInt(uint64_t &result) {
                                      ^
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1033:41: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
    if (failed(dialectReader.readVarInt(propertiesIdx)))
                                        ^~~~~~~~~~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:926:38: note: passing argument to parameter 'result' here
  LogicalResult readVarInt(uint64_t &result) override {
                                     ^
2 errors generated.

/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:1033:41: error: non-const lvalue reference to type 'uint64_t' (aka 'unsigned long long') cannot bind to a value of unrelated type 'size_t' (aka 'unsigned long')
    if (failed(dialectReader.readVarInt(propertiesIdx)))
                                        ^~~~~~~~~~~~~
/Users/jiefu/llvm-project/mlir/lib/Bytecode/Reader/BytecodeReader.cpp:926:38: note: passing argument to parameter 'result' here
  LogicalResult readVarInt(uint64_t &result) override {
                                     ^
1 error generated.

Added: 
    

Modified: 
    mlir/lib/Bytecode/Reader/BytecodeReader.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
index bd9f045a1020..645e4ef3d4e7 100644
--- a/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
+++ b/mlir/lib/Bytecode/Reader/BytecodeReader.cpp
@@ -1003,7 +1003,7 @@ class PropertiesSectionReader {
     if (sectionData.empty())
       return success();
     EncodingReader propReader(sectionData, fileLoc);
-    size_t count;
+    uint64_t count;
     if (failed(propReader.parseVarInt(count)))
       return failure();
     // Parse the raw properties buffer.
@@ -1029,7 +1029,7 @@ class PropertiesSectionReader {
 
   LogicalResult read(Location fileLoc, DialectReader &dialectReader,
                      OperationName *opName, OperationState &opState) {
-    size_t propertiesIdx;
+    uint64_t propertiesIdx;
     if (failed(dialectReader.readVarInt(propertiesIdx)))
       return failure();
     if (propertiesIdx >= offsetTable.size())


        


More information about the Mlir-commits mailing list