diff options
Diffstat (limited to 'src/passes/PostEmscripten.cpp')
-rw-r--r-- | src/passes/PostEmscripten.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/passes/PostEmscripten.cpp b/src/passes/PostEmscripten.cpp index 6dc32eaa8..b7d3e9f91 100644 --- a/src/passes/PostEmscripten.cpp +++ b/src/passes/PostEmscripten.cpp @@ -95,12 +95,11 @@ static void calcSegmentOffsets(Module& wasm, return; } } - auto it = offsets.find(curr->segment); - if (it != offsets.end()) { + if (offsets.find(curr->segment) != offsets.end()) { Fatal() << "Cannot get offset of passive segment initialized " "multiple times"; } - offsets[curr->segment] = dest->value.getInteger(); + offsets[curr->segment] = dest->value.getUnsigned(); } } searcher(passiveOffsets); searcher.walkModule(&wasm); @@ -317,7 +316,7 @@ struct PostEmscripten : public Pass { // The first operand is the function pointer index, which must be // constant if we are to optimize it statically. if (auto* index = curr->operands[0]->dynCast<Const>()) { - size_t indexValue = index->value.getInteger(); + size_t indexValue = index->value.getUnsigned(); if (indexValue >= flatTable.names.size()) { // UB can lead to indirect calls to invalid pointers. return; |