@@ -293,56 +293,58 @@ To silence reports from unsigned integer overflow, you can set
293293``-fsanitize-recover=unsigned-integer-overflow ``, is particularly useful for
294294providing fuzzing signal without blowing up logs.
295295
296- Issue Suppression
297- =================
298-
299- UndefinedBehaviorSanitizer is not expected to produce false positives.
300- If you see one, look again; most likely it is a true positive!
301-
302- Disabling Instrumentation with ``__attribute__((no_sanitize("undefined"))) ``
303- ----------------------------------------------------------------------------
304-
305- You disable UBSan checks for particular functions with
306- ``__attribute__((no_sanitize("undefined"))) ``. You can use all values of
307- ``-fsanitize= `` flag in this attribute, e.g. if your function deliberately
308- contains possible signed integer overflow, you can use
309- ``__attribute__((no_sanitize("signed-integer-overflow"))) ``.
310-
311- This attribute may not be
312- supported by other compilers, so consider using it together with
313- ``#if defined(__clang__) ``.
314-
315- Disabling instrumentation of common overflow idioms
316- =====================================================
296+ Disabling instrumentation for common overflow patterns
297+ ------------------------------------------------------
317298
318- There are certain overflow-dependent code patterns which produce a lot of noise
319- for integer overflow/truncation sanitizers. To disable instrumentation for
320- these common patterns one should use ``-fno-sanitize-overflow-idioms ``. Its
321- inverse ``-fsanitize-overflow-idioms `` also exists but has no function other
322- than to disable an already present ``-fno-sanitize-overflow-idioms ``.
299+ There are certain overflow-dependent or overflow-prone code patterns which
300+ produce a lot of noise for integer overflow/truncation sanitizers. To disable
301+ instrumentation for these common patterns one should use
302+ ``-fsanitize-overflow-pattern-exclusion= ``.
323303
324- Currently, this option handles three pervasive overflow-dependent code idioms:
304+ Currently, this option supports three pervasive overflow-dependent code idioms:
325305
326306.. code-block :: c++
327307
308+ /// -fsanitize-overflow-pattern-exclusion=negated-unsigned-const
328309 unsigned long foo = -1UL; // No longer causes a negation overflow warning
329310 unsigned long bar = -2UL; // and so on...
330311
331312.. code-block :: c++
332313
314+ /// -fsanitize-overflow-pattern-exclusion=post-decr-while
333315 unsigned char count = 16;
334316 while (count--) { /* ... */ } // No longer causes unsigned-integer-overflow sanitizer to trip
335317
336318.. code-block :: c++
337319
320+ /// -fsanitize-overflow-pattern-exclusion=add-overflow-test
338321 if (base + offset < base) { /* ... */ } // The pattern of `a + b < a`, and other re-orderings,
339322 // won't be instrumented (same for signed types)
340323
341324Negated unsigned constants, post-decrements in a while loop condition and
342- simple overflow checks are accepted and pervasive code patterns. Existing
343- projects that enable more warnings or sanitizers may find that the compiler is
344- too noisy. Now, they can use ``-fno-sanitize-overflow-idioms `` with no source
345- modifications.
325+ simple overflow checks are accepted and pervasive code patterns. You can enable
326+ all exclusions with ``-fsanitize-overflow-pattern-exclusion=all `` or disable
327+ all exclusions with ``-fsanitize-overflow-pattern-exclusion=none ``. Specifying
328+ ``none `` has precedence over other values.
329+
330+ Issue Suppression
331+ =================
332+
333+ UndefinedBehaviorSanitizer is not expected to produce false positives.
334+ If you see one, look again; most likely it is a true positive!
335+
336+ Disabling Instrumentation with ``__attribute__((no_sanitize("undefined"))) ``
337+ ----------------------------------------------------------------------------
338+
339+ You disable UBSan checks for particular functions with
340+ ``__attribute__((no_sanitize("undefined"))) ``. You can use all values of
341+ ``-fsanitize= `` flag in this attribute, e.g. if your function deliberately
342+ contains possible signed integer overflow, you can use
343+ ``__attribute__((no_sanitize("signed-integer-overflow"))) ``.
344+
345+ This attribute may not be
346+ supported by other compilers, so consider using it together with
347+ ``#if defined(__clang__) ``.
346348
347349Suppressing Errors in Recompiled Code (Ignorelist)
348350--------------------------------------------------
0 commit comments