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