Aliasing
lastmod 2018-08-17created 2015-11-101 edits
Aliasing is the state in which the same memory address can be accessed through different names. For example, when two pointers point to the same memory, each is an alias pointer of the other.
A brief note on the compiler option 'strict aliasing': it means the compiler assumes that 'variables of different types do not point to the same memory'. This </code>-fstrict-aliasing<code> is on by default in gcc. To turn this check off, use -fno-strict-option. The related warning option is -Wstrict-aliasing, but reportedly you should not assume that all aliasing problems are gone just because no warning appears. Where possible, use the -fstrict-aliasing option and pay attention to aliasing.
Because the -fstrict-aliasing option makes the compiler assume there is no aliasing, it can also benefit optimization.
See also
Favorite site
References
-
Gcc_fno_strict_aliasing_option.pdf ↩