[clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)
Kees Cook via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 23 19:08:56 PDT 2025
================
@@ -2885,7 +2885,7 @@ static bool CheckedIntArithmetic(EvalInfo &Info, const Expr *E,
APSInt Value(Op(LHS.extend(BitWidth), RHS.extend(BitWidth)), false);
Result = Value.trunc(LHS.getBitWidth());
- if (Result.extend(BitWidth) != Value) {
+ if (Result.extend(BitWidth) != Value && !E->getType().isWrapType()) {
----------------
kees wrote:
`trap` (nee `no_wrap`) is not UB. The main .rst docs explain all the usage semantics.
https://github.com/llvm/llvm-project/pull/148914
More information about the cfe-commits
mailing list