================ @@ -293,6 +293,40 @@ To silence reports from unsigned integer overflow, you can set ``-fsanitize-recover=unsigned-integer-overflow``, is particularly useful for providing fuzzing signal without blowing up logs. +Disabling instrumentation for common overflow patterns +------------------------------------------------------ + +There are certain overflow-dependent or overflow-prone code patterns which +produce a lot of noise for integer overflow/truncation sanitizers. To disable +instrumentation for these common patterns one should use +``-fsanitize-overflow-pattern-exclusion=``. + +Currently, this option supports three pervasive overflow-dependent code idioms: + +.. code-block:: c++ + + /// -fsanitize-overflow-pattern-exclusion=negated-unsigned-const + unsigned long foo = -1UL; // No longer causes a negation overflow warning + unsigned long bar = -2UL; // and so on... + +.. code-block:: c++ + + /// -fsanitize-overflow-pattern-exclusion=post-decr-while + unsigned char count = 16; + while (count--) { /* ... */ } // No longer causes unsigned-integer-overflow sanitizer to trip + +.. code-block:: c++ + + /// -fsanitize-overflow-pattern-exclusion=add-overflow-test + if (base + offset < base) { /* ... */ } // The pattern of `a + b < a`, and other re-orderings, + // won't be instrumented (same for signed types) + +Negated unsigned constants, post-decrements in a while loop condition and ---------------- bwendling wrote:
This first line could go to the first paragraph? https://github.com/llvm/llvm-project/pull/100272 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits