Boost logo

Boost Users :

Subject: [Boost-users] gcc optimization and boost::any
From: John (john_at_[hidden])
Date: 2009-03-15 13:39:24


Is anyone aware of a bug/quirk in boost::any that is exposed by GCC
optimization? (Or vice versa: a bug in GCC optimization exposed by boost::any)?

We've got a particularly insidious runtime bug that appears under `-O2` with gcc
version 4.2.2, but not with gcc 3.3.3, and not with gcc 4.3.3.

We narrowed it down to a single .cpp file, which contains a single method, which
does nothing but call boost::any_cast several times to extract a pointer from a
boost::any instance. By compiling this file under -O2, (gcc version 4.2.2) we
can cause the bug. By compiling without any `-O` flags, the bug does not appear.
(boost version 1_34_1).

We're working to identify a minimal test case that we can post here. We still
haven't pinpointed the exact cause. To be clear, we're not 100% sure the bug is
in boost::any or gcc -- it merely appears to be so since changing compiler flags
or compiler versions makes the bug disappear.

If you know of such a bug or quirk in either GCC or boost::any, or of a write-up
of this somewhere... or even some idle speculation... it could save us a lot of
time tracking this down.

Thanks, -John


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net