[C++-sig] Boost.Python in SUSE 9.0 or SUSE 9.1?

Chris Hoeppler hoeppler at diener.iap.physik.uni-tuebingen.de
Tue Jun 29 18:01:42 CEST 2004


On Fri, 25 Jun 2004, Ralf W. Grosse-Kunstleve wrote:

> You have to strip down the code until you've isolated the construct that causes
> the ICE. Then try to rearrange that construct until the ICE goes away. In the
> early days of Boost.Python I've done this a million times, and I am sure David
> did it a billion times. It always takes too long, is very frustrating, and
> therefore requires a lot of determination. If this is not enough to scare you,
> copy the content of boost/python.hpp into your source file, then comment out
> half the includes, see if it still ICE's, if yes comment out half of the
> remaining, if not put back half of the ones you commented out, and so on until
> you've found that one include that makes a difference. Then copy that into your
> source code and repeat the exercise until you found the piece of code that
> makes the difference. Then go into a different trial-and-error loop rearranging
> the code. While the first step requires mainly determination, you will need
> some creativity here. Often my last resort was to ask David. Finally you have
> to communicate the fix to the developers of the effected library (e.g. it could
> be in boost::graph or boost::bind or, heaven forbid, in boost::mpl or ...) and
> convince them to adopt your fix.

Okay. Thanks for the encouragement, Ralf. Here's the result of my
'investigation':

On the following system:

    gcc version 3.3.1 (SuSE Linux 9.0)
    boost-1.31

if I try to compile <boost/python/detail/translate_exception.hpp> (copied
to test.cpp) with the following command line

    g++ -Wall -ftemplate-depth-100 -DBOOST_PYTHON_DYNAMIC_LIB -g -O0 -fno-inline -fPIC -DDEBUG -I/usr/local/include/python2.3
-I/usr/local/include/boost-1_31 -c -o test.os test.cpp

the compiler segfaults with the following message:
    /usr/include/g++/bits/basic_string.h:728: internal compiler error:
Segmentation fault

The relevant line in translate_exception.hpp triggering the segfault is
indicated below:

template <class ExceptionType, class Translate>
struct translate_exception
{
    typedef typename add_reference<
        typename add_const<ExceptionType>::type
    >::type exception_cref;

    inline bool operator()(
        exception_handler const& handler
      , function0<void> const& f
      , typename call_traits<Translate>::param_type translate) const
    {
        try
        {
            return handler(f);
        }
        catch(exception_cref e)
--------------^^^^^^^^^^^^^^^^
        {
            translate(e);
            return true;
        }
    }
};

FWIW, the compiler is happy with  "catch(exception_cref &e)", though I do
--------------------------------------------------------^
not know whether it would be okay to make that change...

Chris.





More information about the Cplusplus-sig mailing list