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

Stefan Seefeld seefeld at sympatico.ca
Mon Dec 5 22:10:40 CET 2005


David Abrahams wrote:

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?

I thought the problem here was that C++ allows more alias analysis (and thus, optimimzation) due to its type-safety, meaning that the potentially wrong code would be generated from compiling boost.python together with whatever is available through python headers.

At least that's my interpretation of the issue...

Regards, Stefan



More information about the Cplusplus-sig mailing list