[C++-sig] boost/python 1.33.1 breaks aliasing rules
Philipp Thomas
pth at suse.de
Thu Dec 1 17:19:31 CET 2005
We use a patch for gcc 4.1 that also makes it warn about violations of the C/C++ aliasing
rules in C++ code (stock gcc only warns for C code). For the code in boost 1.33.1 I get
warning: dereferencing type-punned pointer will break strict-aliasing rules
for the following files:
/usr/src/packages/BUILD/boost_1_33_1/libs/python/build/../src/long.cpp: 12,19, 26
/usr/src/packages/BUILD/boost_1_33_1/libs/python/build/../src/dict.cpp: 32
/usr/src/packages/BUILD/boost_1_33_1/libs/python/build/../src/tuple.cpp:12
/usr/src/packages/BUILD/boost_1_33_1/libs/python/build/../src/str.cpp: 12
/usr/src/packages/BUILD/boost_1_33_1/libs/python/build/../src/object/class.cpp:543,553
/usr/src/packages/BUILD/boost_1_33_1/libs/python/build/../src/list.cpp: 15
As our package build system treats this type of warning as errors, I will
use -fno-strict-aliasing for gcc as I'm not familiar with that code and I
want to get the package built.
For boost you should also consider either using said gcc switch or fix the
code to not break strict-aliasing rules as such code leads gcc to opmize in a
way it shouldn't (for instance by eliminating variables which makes access
through a type-punned pointer return garbage).
Philipp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20051201/f77fbc47/attachment.pgp>
More information about the Cplusplus-sig
mailing list