Subject: [Boost-bugs] [Boost C++ Libraries] #11357: bug for coroutines with segmented stack
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-28 14:58:44
#11357: bug for coroutines with segmented stack
-----------------------------------------+-----------------------
Reporter: wilhelm.lee <wilhelm.lee@â¦> | Owner: olli
Type: Bugs | Status: new
Milestone: Boost 1.58.0 | Component: coroutine
Version: Boost 1.58.0 | Severity: Problem
Keywords: coroutines segmented stack |
-----------------------------------------+-----------------------
when I test asymmetric coroutines with segmented stack with boost
/example/cpp03/asymmetric/segmented_stack.cpp , but test failed for
segment fault .
boost 1.58 , build with toolset=gcc segmented-stacks=on
gcc version 4.8.1 , -fsplit-stack
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 __splitstack_makecontext() , and
coroutine_context::jump() use internal_stack_ctx , when call
__splitstack_setcontext( other.stack_ctx_.segments_ctx) ,
other.stack_ctx_.segments_ctx is empty !
and push_coroutine_object/pull_coroutine_object::deallocate_(obj_t * obj)
use stack_ctx not internal_stack_ctx
I try to modify source with :
boost/coroutine/asymmetric_coroutine.hpp
all "stack_context internal_stack_ctx;" => "stack_context
internal_stack_ctx(stack_ctx);"
boost/coroutine/detail/push_coroutine_object.hpp
boost/coroutine/detail/pull_coroutine_object.hpp
all :
static void deallocate_( obj_t * obj){
stack_context stack_ctx( obj->stack_ctx_);
+ # ifdef BOOST_USE_SEGMENTED_STACKS
+ memcpy(
stack_ctx.segments_ctx,obj->callee.stack_ctx().segments_ctx,
BOOST_COROUTINES_SEGMENTS*sizeof(char *) ) ;
+ # endif
StackAllocator stack_alloc( obj->stack_alloc_);
}
and test passed . but this modification seems not the best. to combine
stack_ctx and internal_stack_ctx to a single object seems better !
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/11357> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC