I'm following the "Getting started" tutorial from the Boost website. I'm trying to build separatly-compiled libraries using the following commands:
./bootstrap.sh
and then
./b2
During the building, I'm getting a lot (like hundreds) of those warnings:
./boost/...whatever.hpp:linenumber: warning: dereferencing pointer ‘...’ does break strict-aliasing rules
I'd like to know if it is a problem on my side and if I can do something to get rid of these warnings?
Thanks.
(Boost 1.48, Ubuntu 10.04.3 LTS)
Cellperformance states that strict aliasing is:
[...] an assumption, made by the C (or C++) compiler, that dereferencing pointers to objects of different types will never refer to the same memory location (i.e. alias eachother.)
This warning occurs when -fno-strict-aliasing
and optimizations (-O2
or higher) are enabled because the compiler needs to be much more conservative when its accessing (possibly) aliased memory. This leads to less optimizations - the compiler can't e.g. really be sure that elements doesn't overlap (see example in article posted above).
This is not a warning you should worry about - the Boost developers are probably aware of this and have good reasons to why this is ok.