File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -2489,6 +2489,23 @@ are listed below.
2489
2489
2490
2490
$ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc
2491
2491
2492
+ Strict Aliasing
2493
+ ---------------
2494
+
2495
+ Clang by default applies C/C++'s strict aliasing rules during optimizations. In
2496
+ cases C and C++ rules diverge, the more conservative rules are used. Clang does
2497
+ not make use of strict aliasing rules in all cases yet, including unions and
2498
+ variable-sized arrays. That may change in the future.
2499
+
2500
+ As of Clang 20, strict aliasing rules are also applied to nested pointers. The
2501
+ new behavior can be disabled using ``-fno-pointer-tbaa ``. Note that Clang does
2502
+ not apply strict aliasing rules to `void* ` pointers to avoid breaking existing
2503
+ code, even though this is not required by the standard.
2504
+
2505
+ Strict aliasing violations in the source may change program behavior and
2506
+ ``-fno-strict-aliasing `` disables use of the strict aliasing rules. There also
2507
+ is an experimental :doc: `TypeSanitizer ` to detect strict aliasing voliations.
2508
+
2492
2509
Profile Guided Optimization
2493
2510
---------------------------
2494
2511
You can’t perform that action at this time.
0 commit comments