Boost C++ Libraries: Ticket #11356: bug for coroutines with BOOST_USE_SEGMENTED_STACKS https://svn.boost.org/trac10/ticket/11356 <p> when I test asymmetric coroutines with segmented stack with boost /example/cpp03/asymmetric/segmented_stack.cpp , but test failed for segment fault . </p> <p> boost 1.58 , build with toolset=gcc segmented-stacks=on gcc version 4.8.1 , -fsplit-stack </p> <p> the bug description : in asymmetric_coroutine.hpp: boost use tow stack_context object(stack_ctx and internal_stack_ctx),but only stack_ctx.segments_ctx saved information(split stacks chain and boundary..) filled by <span class="underline">splitstack_makecontext() , and coroutine_context::jump() use internal_stack_ctx , when call </span>splitstack_setcontext( other.stack_ctx_.segments_ctx) , other.stack_ctx_.segments_ctx is empty ! </p> <p> and push_coroutine_object/pull_coroutine_object::deallocate_(obj_t * obj) use stack_ctx not internal_stack_ctx </p> <p> I try to modify source with : boost/coroutine/asymmetric_coroutine.hpp </p> <blockquote> <p> all "stack_context internal_stack_ctx;" =&gt; "stack_context internal_stack_ctx(stack_ctx);" </p> </blockquote> <p> boost/coroutine/detail/push_coroutine_object.hpp boost/coroutine/detail/pull_coroutine_object.hpp </p> <blockquote> <p> all : static void deallocate_( obj_t * obj){ </p> <blockquote> <p> stack_context stack_ctx( obj-&gt;stack_ctx_); </p> </blockquote> </blockquote> <p> + # ifdef BOOST_USE_SEGMENTED_STACKS + memcpy( stack_ctx.segments_ctx,obj-&gt;callee.stack_ctx().segments_ctx, BOOST_COROUTINES_SEGMENTS*sizeof(char *) ) ; + # endif </p> <blockquote> <p> <a class="missing wiki">StackAllocator</a> stack_alloc( obj-&gt;stack_alloc_); </p> </blockquote> <blockquote> <p> } </p> </blockquote> <p> and test passed . but this modification seems not the best. to combine stack_ctx and internal_stack_ctx to a single object seems better ! </p> <p> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11356 Trac 1.4.3 John Maddock Thu, 28 May 2015 16:12:25 GMT component changed; owner set https://svn.boost.org/trac10/ticket/11356#comment:1 https://svn.boost.org/trac10/ticket/11356#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">olli</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">coroutine</span> </li> </ul> Ticket olli Thu, 04 Jun 2015 05:10:34 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11356#comment:2 https://svn.boost.org/trac10/ticket/11356#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <ul><li>introduction of class preallocated </li><li>Jamfiles fixed </li></ul> Ticket