id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 9180,Valgrind reports usage of uninitialised values,Alexandre Hamez ,olli,"When running the following example with Valgrind: {{{ #include #include typedef boost::coroutines::coroutine generator; void bar(generator::caller_type& yield) { yield(32); } void foo(generator::caller_type& yield) { generator nested_gen(bar); std::cout << nested_gen.get() << std::endl; yield(33); } int main() { generator gen(foo); std::cout << gen.get() << std::endl; return 0; }; }}} I get the following trace (this is an extract, I give only the first error): {{{ $ valgrind --max-stackframe=6516920 --track-origins=yes ./a.out }}} {{{ ==10734== Memcheck, a memory error detector ==10734== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al. ==10734== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info ==10734== Command: ./a.out ==10734== ==10734== Warning: client switching stacks? SP change: 0x7ff0001b8 --> 0x512af98 ==10734== to suppress, use: --max-stackframe=34257850912 or greater ==10734== Warning: client switching stacks? SP change: 0x512aca8 --> 0x5761f98 ==10734== to suppress, use: --max-stackframe=6517488 or greater ==10734== Use of uninitialised value of size 8 ==10734== at 0x4C0E727: jump_fcontext (in /home/ahamez/usr/boost1.54/lib/libboost_context.so.1.54.0) ==10734== by 0x40C6E9: boost::coroutines::detail::coroutine_object&), boost::coroutines::detail::standard_stack_allocator, std::allocator >, boost::coroutines::coroutine, int, 0>::coroutine_object(void (*)(boost::coroutines::coroutine&), boost::coroutines::attributes const&, boost::coroutines::detail::standard_stack_allocator const&, std::allocator&), boost::coroutines::detail::standard_stack_allocator, std::allocator >, boost::coroutines::coroutine, int, 0> > const&) (in /home/ahamez/a.out) ==10734== by 0x407F29: boost::coroutines::coroutine::coroutine&)>(void (*)(boost::coroutines::coroutine&), boost::coroutines::attributes const&, boost::coroutines::detail::standard_stack_allocator const&, std::allocator > const&, boost::disable_if&), boost::rv&)>&>, boost::coroutines::coroutine::dummy*>::type) (in /home/ahamez/a.out) ==10734== by 0x403DB9: foo(boost::coroutines::coroutine&) (in /home/ahamez/a.out) ==10734== by 0x410A1C: boost::coroutines::detail::coroutine_object&), boost::coroutines::detail::standard_stack_allocator, std::allocator >, boost::coroutines::coroutine, int, 0>::run() (in /home/ahamez/a.out) ==10734== by 0x40EAC6: void boost::coroutines::detail::trampoline1&), boost::coroutines::detail::standard_stack_allocator, std::allocator >, boost::coroutines::coroutine, int, 0> >(long) (in /home/ahamez/a.out) ==10734== by 0x4C0E6BD: make_fcontext (in /home/ahamez/usr/boost1.54/lib/libboost_context.so.1.54.0) ==10734== Uninitialised value was created by a stack allocation ==10734== at 0x4C0E723: jump_fcontext (in /home/ahamez/usr/boost1.54/lib/libboost_context.so.1.54.0) }}} Tested under MacOS X 10.8 with clang 3.3 and under Linux (CentOS 6) with gcc 4.8. I can't say if it's just Valgrind which can't cope with coroutines or if it's a real bug from Boost.Coroutine.",Bugs,closed,To Be Determined,coroutine,Boost 1.54.0,Problem,wontfix,,