Skip to content

Commit 9838b39

Browse files
sstanglkripken
authored andcommitted
Fix comparison signedness errors in optimizeMemoryAccess() (#2211)
1 parent 90449a5 commit 9838b39

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/passes/OptimizeInstructions.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,9 +1219,9 @@ struct OptimizeInstructions
12191219
// don't do this if it would wrap the pointer
12201220
uint64_t value64 = last->value.geti32();
12211221
uint64_t offset64 = offset;
1222-
if (value64 <= std::numeric_limits<int32_t>::max() &&
1223-
offset64 <= std::numeric_limits<int32_t>::max() &&
1224-
value64 + offset64 <= std::numeric_limits<int32_t>::max()) {
1222+
if (value64 <= uint64_t(std::numeric_limits<int32_t>::max()) &&
1223+
offset64 <= uint64_t(std::numeric_limits<int32_t>::max()) &&
1224+
value64 + offset64 <= uint64_t(std::numeric_limits<int32_t>::max())) {
12251225
last->value = Literal(int32_t(value64 + offset64));
12261226
offset = 0;
12271227
}

0 commit comments

Comments
 (0)