Boost logo

Boost Users :

Subject: [Boost-users] Bus error side effect from boost::logging
From: Allen Cronce (allenslists_at_[hidden])
Date: 2009-01-04 19:35:02


I'm tracking down an intermittent bus error under Mac OS X 10.5.6 that
happens when formatting a double as a string. The crash can happen
when outputting to a stream, when calling printf, or when using
boost::format. Of course the crash only happens in our release build,
which always makes things more fun ;-)

Here's a sample routine that can trigger the bus error in our unit test:

--snip--
int TestDoubleFormatBusError(void)
{
        std::cout << "\nTesting double format problem..." << std::endl;

        uint64_t testMicroseconds = 100000;
        double delta = 179;
        double percentOff;
        percentOff = (delta / testMicroseconds) * 100;

        std::cout << percentOff; // <-- This is where the crash sometimes
happens.

        return 0;
}
--snip--

I'm pretty sure that there's nothing wrong with the above code, but
I'm open to suggestions.

After binary chopping, I determined that the crash only happens after
invoking John Torjo's experimental boost::logging. If I disable
logging, the problem goes away.

Has anyone seen this problem? John, do you have any suggestions for
understanding and resolving the crash?

Thanks in advance.

Best,

--
Allen Cronce

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