[C++-sig] A very strange behaviour of Boost (Mingw, gcc 4.5)

Jérôme Laheurte fraca7 at free.fr
Fri Jun 10 18:07:43 CEST 2011

Le 10 juin 2011 à 17:00, Niall Douglas a écrit :

> On 10 Jun 2011 at 16:03, Jérôme Laheurte wrote:
>>> Might this be a symbol visibility problem?
>> How can I check that ? I just tried #defining
>> BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY in boost/python/detail/config.hpp
>> and rebuilt the whole stuff but there's no difference.
> I have little experience of Mingw personally. If I want to build for
> Windows, I use MSVC :)
> On POSIX, older versions of the GCC runtime require you to always
> keep symbols which are used to throw exceptions as default visibility
> as they compare symbols by address not content. Newer GCC runtimes
> finally do what I said they should have done from the beginning which
> is to string compare the mangled symbol.
> If BPL is throwing an exception and the catch handler isn't being
> found like it ought to be, this suggests they've broken the above in
> the Mingw port of GCC somehow. It could also be a problem of stack
> corruption causing the unwind records to get corrupted. I can't be
> any more definite because how PE binaries use symbols differently to
> ELF kinda suggests that GCC surely isn't copying the POSIX GCC
> exception type matching system anyway.
> If you're really keen on continuing to use Mingw, I'd first suggest
> you see if you can duplicate the problem in Cygwin. If you can you'll
> get a much bigger audience. Then you'll need a very reduced example
> exhibiting the bug, one not including Boost. Then you'll need to come
> up with a patch to PE GCC to fix it and wait the whatever number of
> weeks to get it into mainline.
> Or you could stick with an older version of Mingw and wait till
> someone else fixes the problem. Or use MSVC.

Not really an option; GCC 4 gave us a factor 3 performance improvement over GCC 3, which we really need, and we're not really MSVC people.

> BTW, debugging exception throws is a royal PITA. There ought to be
> some debug code in the GCC runtime if I remember, you could try
> turning that on and it will print each stage of what it does when you
> throw and/or rethrow an exception.

OK Thanks for all the tips. Basically, this is not a Boost issue so I'll have to follow the GCC bug track :)

Jérôme Laheurte

More information about the Cplusplus-sig mailing list