[C++-sig] boost/python 1.33.1 breaks aliasing rules (original) (raw)

David Abrahams dave at boost-consulting.com
Mon Dec 5 21:45:38 CET 2005


Philipp Thomas <pth at suse.de> writes:

Can Philipp explain why we should invest energy in trying to make these warnings go away? gcc bases parts of its optimisations on the result of the strict-alias analysis. So for instance objects (still non-C++ sense) will be eliminated if gcc determines that they aren't accessed by a pointer of the allowed type. So an access via a type-punned pointer will return garbage in this case.

But we can't control it, can we? Python is going to access that data, and you can't use Python without that sort of punning. If Python is compiled with optimizations that take advantage of those aliasing rules, everybody who uses it will have the same problem. What alternative do we have?

-- Dave Abrahams Boost Consulting www.boost-consulting.com



More information about the Cplusplus-sig mailing list