[Boost-bugs] [Boost C++ Libraries] #9035: Coroutine test code should produce segmentation fault, but actually not.

Subject: [Boost-bugs] [Boost C++ Libraries] #9035: Coroutine test code should produce segmentation fault, but actually not.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-08-22 14:03:13


#9035: Coroutine test code should produce segmentation fault, but actually not.
------------------------------+-----------------------
 Reporter: anonymous | Owner: olli
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: coroutine
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
------------------------------+-----------------------
 According to Boost Coroutine documentation, the following piece of code
 shall produce segmentation fault, since "c"'s stack gets unwound and "x"
 should remain to be a nullptr, however "x" becomes non-null after the
 scoped coroutine code.

 I am not sure (since I am very new to Boost Coroutine lib) whether it is
 because of my mistake.

 My Boost 1.54 was compiled using Clang 3.3.
 I tested the code both using Clang 3.4 trunk and GCC 4.6.4.

 Thanks.

 ===================================

 #include <boost/coroutine/all.hpp>

 struct X {
   void g() {}
 };

 typedef boost::coroutines::coroutine<X*()> coro_t;

 void fn(coro_t::caller_type& ca) {
   X local;
   ca(&local);
 }

 int main() {
   X* x = 0;
   {
     coro_t c(fn);
     x = c.get();
   }

   x->g();
   return 0;
 }

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9035>
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:13 UTC