[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-cpp-sig
Subject:    [C++-sig] type-punning in boost python code.
From:       pth () suse ! de (Philipp Thomas)
Date:       2005-11-25 17:16:15
Message-ID: 20051125171615.GE7473 () paradies ! suse ! de
[Download RAW message or body]

our gcc 4.1 also analyses C++ code for violation of the C/C++ aliasing
rules (mainline doesn't do so yet). 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 warning as an error, 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. I'd recommend doing the latter as
switching off aliasing analysis will inhibit some optimisations.

Philipp

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic