[clang] [clang] Add flag for relaxed pointer subtraction (PR #196392)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 20 05:41:47 PDT 2026
================
@@ -113,6 +113,9 @@ latest release, please see the [Clang Web Site](https://clang.llvm.org) or the
### New Compiler Flags
+- New option `-fstable-pointer-subtraction` added to preserve stable semantics
----------------
eleviant wrote:
Yep, the main goal is to remove the `exact` qualifier from sdiv/ashr which may result in UB if pointer subtraction result is not aligned properly. MSVC can fold sdiv to ashr if type size is power of two, so you're right about rounding.
https://github.com/llvm/llvm-project/pull/196392
More information about the cfe-commits
mailing list