https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105880

--- Comment #4 from Chris Johns <chrisj at rtems dot org> ---
(In reply to Andrew Pinski from comment #3)
> Sounds like the order of deconstructors is wrong.
> Where is __cxxabiv1::__cxa_get_globals being called from that is the problem?

The `std::ios_base::Init::~Init()` is being called after this object has
destructed.

The ios_base class uses a sentry to check the state. The code in it's
destructor is:

if (bool(_M_os.flags() & ios_base::unitbuf) && !uncaught_exception())  

The std::cerr object has ios_base::unitbuf set so uncaught_exception() is
called. This call gets the cxa globals:

__cxa_eh_globals *globals = __cxa_get_globals ();

Reply via email to