[clang] [Clang] Add -fwrapv-pointer flag (PR #122486)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 24 06:56:35 PST 2025


================
@@ -79,7 +79,15 @@ code bases.
   Undefined behavior due to pointer addition overflow can be reliably detected
   using ``-fsanitize=pointer-overflow``. It is also possible to use
   ``-fno-strict-overflow`` to opt-in to a language dialect where signed integer
-  and pointer overflow are well-defined.
+  and pointer overflow are well-defined. Since Clang 20, it is also possible
+  to use ``-fwrapv-pointer`` to only make pointer overflow well-defined, while
+  not affecting the behavior of signed integer overflow.
+
+- The ``-fwrapv`` flag now only makes signed integer overflow well-defined,
----------------
AaronBallman wrote:

Curiously enough, we only ever documented the signed integer overflow behavior, not the pointer overflow: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fwrapv

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


More information about the cfe-commits mailing list