[clang] [compiler-rt] [Sanitizer] add signed-integer-wrap sanitizer (PR #80089)

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 20 11:19:52 PST 2024


================
@@ -193,7 +193,14 @@ Available checks are:
      signed division overflow (``INT_MIN/-1``), but not checks for
      lossy implicit conversions performed before the computation
      (see ``-fsanitize=implicit-conversion``). Both of these two issues are
-     handled by ``-fsanitize=implicit-conversion`` group of checks.
+     handled by ``-fsanitize=implicit-conversion`` group of checks. Note that
+     ``-fwrapv`` implicitly disables instrumentation for much of the arithmetic
+     covered by ``-fsanitize=signed-integer-overflow``.
+  -  ``-fsanitize=signed-integer-wrap``: Signed Integer wraparound, where the
+     result of a signed integer computation wraps around. Behaves identically
+     to ``-fsanitize=signed-integer-overflow`` when ``-fwrapv`` is enabled.
+     Without ``-fwrapv`` or ``-fno-strict-overflow``, this sanitizer will only
+     instrument division operations.
----------------
vitalybuka wrote:

Actually it's very inconsistent that the sanitizer is less strict without `-fwrapv`, when for `signed-integer-overflow` we have an opposite.

https://github.com/llvm/llvm-project/pull/80089


More information about the cfe-commits mailing list