[llvm] Avoid undefined behavior in shift operators during constant folding of DIExpressions. (PR #116466)
Tom Honermann via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 16 13:48:29 PST 2024
================
@@ -59,12 +59,14 @@ foldOperationIfPossible(uint64_t Const1, uint64_t Const2,
return Const1 - Const2;
}
case dwarf::DW_OP_shl: {
- if ((uint64_t)countl_zero(Const1) < Const2)
+ if (Const2 >= std::numeric_limits<uint64_t>::digits ||
+ (uint64_t)countl_zero(Const1) < Const2)
----------------
tahonermann wrote:
Fixed, thanks!
https://github.com/llvm/llvm-project/pull/116466
More information about the llvm-commits
mailing list