Skip to content

Commit f8b0861

Browse files
Moerafaatmakslevental
authored andcommitted
[ANALYSIS] Fixing overflow in AxisInfo.cpp. (triton-lang#5821)
UBSan detected that the shift is happening on an int32 variable, but the shift amount could be larger than what int32 supports. I believe the change is trivial to require a test, but please advice accordingly if you think there is an appropriate way to capture this.
1 parent a1a6b70 commit f8b0861

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Analysis/AxisInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ class ShROpAxisInfoVisitor final : public BinaryOpVisitorImpl<OpTy> {
935935
// Treat [2^n,2^n+1,...]'s divisibility as 1 instead of 2^n
936936
lhsDivisibility = 1;
937937
}
938-
return std::max<int64_t>(1, lhsDivisibility / (1 << shift));
938+
return std::max<int64_t>(1, lhsDivisibility / (int64_t(1) << shift));
939939
}
940940

941941
int64_t getConstancy(OpTy op, const AxisInfo &lhs, const AxisInfo &rhs,

0 commit comments

Comments
 (0)