Skip to content

Commit cce997e

Browse files
committed
!fixup address comments, thanks
1 parent dbe6e52 commit cce997e

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

clang/docs/UsersManual.rst

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,6 +2489,8 @@ are listed below.
24892489
24902490
$ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc
24912491
2492+
.. _strict_aliasing:
2493+
24922494
Strict Aliasing
24932495
---------------
24942496

@@ -2513,8 +2515,7 @@ violates the strict aliasing rules. For example:
25132515
25142516
Strict aliasing can be explicitly enabled with ``-fstrict-aliasing`` and
25152517
disabled with ``-fno-strict-aliasing``. ``clang-cl`` defaults to
2516-
``-fno-strict-aliasing``; see :ref:`Strict aliasing in clang-cl.
2517-
<clang_cl_strict_aliasing>`. Otherwise, Clang defaults to ``-fstrict-aliasing``.
2518+
``-fno-strict-aliasing``; see . Otherwise, Clang defaults to ``-fstrict-aliasing``.
25182519

25192520
C and C++ specify slightly different rules for strict aliasing. To improve
25202521
language interoperability, Clang allows two types to alias if either language
@@ -2529,7 +2530,7 @@ standard aliasing rules in the following ways:
25292530

25302531
Code which violates strict aliasing has undefined behavior. A program that
25312532
works in one version of Clang may not work in another because of changes to the
2532-
optimizer. Clang provides a `:ref:TypeSanitizer <TypeSanitizer>` to help detect
2533+
optimizer. Clang provides a :doc:`TypeSanitizer` to help detect
25332534
violations of the strict aliasing rules, but it is currently still experimental.
25342535
Code that is known to violate strict aliasing should generally be built with
25352536
``-fno-strict-aliasing`` if the violation cannot be fixed.
@@ -2561,7 +2562,7 @@ In Clang 20, Clang strengthened its implementation of strict aliasing for
25612562
accesses of pointer type. Previously, all accesses of pointer type were
25622563
permitted to alias each other, but Clang now distinguishes different pointers
25632564
by their pointee type, except as limited by the relaxations around qualifiers
2564-
and `void*` described above. The previous behavior of treating all pointers as
2565+
and ``void*`` described above. The previous behavior of treating all pointers as
25652566
aliasing can be restored using ``-fno-pointer-tbaa``.
25662567

25672568
Profile Guided Optimization
@@ -5347,14 +5348,6 @@ The Visual C++ Toolset has a slightly more elaborate mechanism for detection.
53475348
Restrictions and Limitations compared to Clang
53485349
----------------------------------------------
53495350

5350-
.. _clang_cl_strict_aliasing:
5351-
5352-
Strict Aliasing
5353-
^^^^^^^^^^^^^^^
5354-
5355-
Strict aliasing (TBAA) is always off by default in clang-cl. Whereas in clang,
5356-
strict aliasing is turned on by default for all optimization levels.
5357-
5358-
To enable LLVM optimizations based on strict aliasing rules (e.g., optimizations
5359-
based on type of expressions in C/C++), user will need to explicitly pass
5360-
`-fstrict-aliasing` to clang-cl.
5351+
Strict aliasing (TBAA) is always off by default in clang-cl whereas in clang,
5352+
strict aliasing is turned on by default for all optimization levels. For more
5353+
details, see :ref:`Strict aliasing <strict_aliasing>`.

0 commit comments

Comments
 (0)