Opened 7 years ago

Closed 7 years ago

#11356 closed Bugs (fixed)

bug for coroutines with BOOST_USE_SEGMENTED_STACKS

Reported by: wilhelm.lee <wilhelm.lee@…> Owned by: olli
Milestone: To Be Determined 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 (2)

comment:1 by John Maddock, 7 years ago

Component: Nonecoroutine
Owner: set to olli

comment:2 by olli, 7 years ago

Resolution: fixed
Status: newclosed
  • introduction of class preallocated
  • Jamfiles fixed
Note: See TracTickets for help on using tickets.