================
@@ -199,6 +233,19 @@ static bool CanElideOverflowCheck(const ASTContext &Ctx, 
const BinOpInfo &Op) {
   if (!Op.mayHaveIntegerOverflow())
     return true;
 
+  const UnaryOperator *UO = dyn_cast<UnaryOperator>(Op.E);
+  if (UO && Ctx.isUnaryOverflowPatternExcluded(UO))
+    return true;
+
+  const auto *BO = dyn_cast<BinaryOperator>(Op.E);
+  if (BO && BO->hasExcludedOverflowPattern())
----------------
JustinStitt wrote:

The current ordering is intentional as I know that the Linux kernel's need from 
OBTs requires pattern exclusions to take precedence over ``wrap`` and 
``no_wrap``. There exists patterns like:

```c
typedef unsigned long __no_wrap safe_size_t;
...
void foo(safe_size_t count) {
  while(count--) ...
}
```

... which we would like to silence. So if needed, the compromise probably 
involves adding `-fsanitize-overflow-pattern-exclusion-strict=` in addition to 
the already existing `-fsanitize-overflow-pattern-exclusion=`.

Open to ideas here. cc @kees 

https://github.com/llvm/llvm-project/pull/148914
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to