Skip to content

Commit 90330f7

Browse files
committed
fix underflow in Pointer::isConstGlobal()
can be triggered when num_nonlocals_src is a power of two
1 parent c8ba1c4 commit 90330f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ir/pointer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ expr Pointer::isConstGlobal() const {
170170
auto generic = bid.uge(has_null_block) &&
171171
expr(num_consts_src > 0) &&
172172
bid.ule(num_consts_src + has_null_block - 1);
173-
auto tgt = bid.uge(num_nonlocals_src) && bid.ule(num_nonlocals - 1);
173+
auto tgt = num_nonlocals_src == 0 ? expr(true) : bid.ugt(num_nonlocals_src-1);
174174
return !isLocal() && (generic || tgt);
175175
}
176176

0 commit comments

Comments
 (0)