Skip to content

Commit e6a6f61

Browse files
committed
!fixpup add info about clang-cl, remove dep on Tysan docs
1 parent 5fb5a3a commit e6a6f61

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

clang/docs/UsersManual.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2497,14 +2497,21 @@ cases C and C++ rules diverge, the more conservative rules are used. Clang does
24972497
not make use of strict aliasing rules in all cases yet, including unions and
24982498
variable-sized arrays. That may change in the future.
24992499

2500+
Internally Clang encodes the strict aliasing rules in LLVM IR using type-based
2501+
alias analysis (TBAA) metadata.
2502+
2503+
Note that clang-cl disables strict aliasing by default, see
2504+
:ref:`Strict aliasing in clang-cl. <clang_cl_strict_aliasing>`
2505+
25002506
As of Clang 20, strict aliasing rules are also applied to nested pointers. The
25012507
new behavior can be disabled using ``-fno-pointer-tbaa``. Note that Clang does
25022508
not apply strict aliasing rules to `void*` pointers to avoid breaking existing
25032509
code, even though this is not required by the standard.
25042510

25052511
Strict aliasing violations in the source may change program behavior and
25062512
``-fno-strict-aliasing`` disables use of the strict aliasing rules. There also
2507-
is an experimental :doc:`TypeSanitizer` to detect strict aliasing voliations.
2513+
is an experimental TypeSanitizer to detect strict aliasing voliations, which
2514+
can be enabled by ``-fsanitize=type``.
25082515

25092516
Profile Guided Optimization
25102517
---------------------------
@@ -5289,6 +5296,7 @@ The Visual C++ Toolset has a slightly more elaborate mechanism for detection.
52895296
Restrictions and Limitations compared to Clang
52905297
----------------------------------------------
52915298

5299+
.. _clang_cl_strict_aliasing:
52925300
Strict Aliasing
52935301
^^^^^^^^^^^^^^^
52945302

0 commit comments

Comments
 (0)