This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] fix PR 54297 - segfaults with std::async


This fixes a stupid mistake I made where the functor and asynchronous
result can go out of scope before the async thread is joined.

The _Async_state_common destructor still needs to be exported from the
library, which is what the macro hack is for.

        PR libstdc++/54297
        * include/std/future (~_Async_state_impl): Join thread before
        derived class members are destroyed.
        (~_Async_state_common): Only define non-trivial destructor when
        included from future.cc for ABI compatibility reasons.
        * src/c++11/future.cc (_GLIBCXX_ABI_COMPAT_ASYNC): Define.
        * testsuite/30_threads/async/54297.cc: New.

Tested x86_64-linux, committed to trunk and 4.7

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]