Infinite loop in __verbose_terminate_handler with -O3 -ipo
Within some Boost.Test-based test cases, my code throws std::logic_error like I want it to. The uncaught exception invokes std::terminate like I want it to. However, when compiling with -O3 -ipo I see an infinite loop in __verbose_terminate_handler. "terminate called recursively" appears over and over on my screen.
Infinite loops in __verbose_terminate_handler have bitten others, and I suspect it is the same rethrow-not-rethrowing mechanism that's killing me here. My problem is, I conjecture, that -ipo is optimizing away the static bool terminating variable appearing in vterminate.cc or somehow the rethrow semantics are broken so that std::terminate is called a second time. -opt-report 3 does not show anything incriminating.
Everything works swell on -O3. ICPC version is 10.1 20081024.
This is yet another fun behavior I cannot seem to reproduce cleanly. Has anyone else experienced this trouble?