[clang] [clang] Implement -fstrict-bool (PR #160790)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 2 08:50:57 PST 2025


=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>,
=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>,
=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/160790 at github.com>


================
@@ -328,6 +328,7 @@ New Compiler Flags
 - New option ``-fsanitize-debug-trap-reasons=`` added to control emitting trap reasons into the debug info when compiling with trapping UBSan (e.g. ``-fsanitize-trap=undefined``).
 - New options for enabling allocation token instrumentation: ``-fsanitize=alloc-token``, ``-falloc-token-max=``, ``-fsanitize-alloc-token-fast-abi``, ``-fsanitize-alloc-token-extended``.
 - The ``-resource-dir`` option is now displayed in the list of options shown by ``--help``.
+- New option ``-f[no-]strict-bool`` added to control whether Clang can assume that ``bool`` values loaded from memory cannot have a bit pattern other than 0 or 1.
----------------
AaronBallman wrote:

I think it'd be a kindness to explain what the default behavior is if you don't pass the flag, just so people don't think the behavior of their code is changing out from under them. WDYT?

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


More information about the cfe-commits mailing list