Opened 7 years ago

Closed 7 years ago

#11357 closed Bugs (duplicate)

bug for coroutines with segmented stack

Reported by: wilhelm.lee <wilhelm.lee@…> Owned by: olli
Milestone: Boost 1.58.0 Component: coroutine
Version: Boost 1.58.0 Severity: Problem
Keywords: coroutines segmented stack Cc:

Description

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 !

Change History (1)

comment:1 by olli, 7 years ago

Resolution: duplicate
Status: newclosed

duplicate : 11356

Note: See TracTickets for help on using tickets.