[all-commits] [llvm/llvm-project] 1295aa: [Clang] Add -fwrapv-pointer flag (#122486)
Nikita Popov via All-commits
all-commits at lists.llvm.org
Tue Jan 28 00:57:22 PST 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 1295aa2e814d1747d69520e34e2c5fb2888e666d
https://github.com/llvm/llvm-project/commit/1295aa2e814d1747d69520e34e2c5fb2888e666d
Author: Nikita Popov <npopov at redhat.com>
Date: 2025-01-28 (Tue, 28 Jan 2025)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/LangOptions.def
M clang/include/clang/Driver/Options.td
M clang/lib/CodeGen/CGBuiltin.cpp
M clang/lib/CodeGen/CGExpr.cpp
M clang/lib/CodeGen/CGExprScalar.cpp
M clang/lib/Driver/SanitizerArgs.cpp
M clang/lib/Driver/ToolChains/CommonArgs.cpp
M clang/lib/Frontend/CompilerInvocation.cpp
M clang/lib/Sema/SemaExpr.cpp
M clang/test/CodeGen/integer-overflow.c
A clang/test/CodeGen/pointer-overflow.c
M clang/test/Driver/clang_wrapv_opts.c
M clang/test/Sema/tautological-pointer-comparison.c
Log Message:
-----------
[Clang] Add -fwrapv-pointer flag (#122486)
GCC supports three flags related to overflow behavior:
* `-fwrapv`: Makes signed integer overflow well-defined.
* `-fwrapv-pointer`: Makes pointer overflow well-defined.
* `-fno-strict-overflow`: Implies `-fwrapv -fwrapv-pointer`, making both
signed integer overflow and pointer overflow well-defined.
Clang currently only supports `-fno-strict-overflow` and `-fwrapv`, but
not `-fwrapv-pointer`.
This PR proposes to introduce `-fwrapv-pointer` and adjust the semantics
of `-fwrapv` to match GCC.
This allows signed integer overflow and pointer overflow to be
controlled independently, while `-fno-strict-overflow` still exists to
control both at the same time (and that option is consistent across GCC
and Clang).
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list