[clang] [Clang] Overflow Idiom Exclusions (PR #100272)
Justin Stitt via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 23 16:30:09 PDT 2024
================
@@ -312,6 +312,38 @@ This attribute may not be
supported by other compilers, so consider using it together with
``#if defined(__clang__)``.
+Disabling instrumentation of common overflow idioms
+=====================================================
+
+There are certain overflow-dependent code patterns which produce a lot of noise
+for integer overflow/truncation sanitizers. To disable instrumentation for
+these common patterns one should use ``-fno-sanitize-overflow-idioms``. Its
+inverse ``-fsanitize-overflow-idioms`` also exists but has no function other
+than to disable an already present ``-fno-sanitize-overflow-idioms``.
+
+Currently, this option handles three pervasive overflow-dependent code idioms:
+
+.. code-block:: c++
+
+ unsigned long foo = -1UL; // No longer causes a negation overflow warning
----------------
JustinStitt wrote:
https://godbolt.org/z/r3a31fKvx I am getting runtime errors.
https://github.com/llvm/llvm-project/pull/100272
More information about the cfe-commits
mailing list