Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#9172 closed Bugs (invalid)

Crash when not preserving FPU

Reported by: Alexandre Hamez <alexandre.hamez@…> Owned by: olli
Milestone: To Be Determined Component: coroutine
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:

Description

I get a SIGBUS when executing the following code:

#include <iostream>
#include <boost/coroutine/coroutine.hpp>

typedef boost::coroutines::coroutine<int()> generator;

void foo(generator::caller_type& yield)
{
  for (std::size_t i = 0; i < 10; ++i)
    yield(i);
}

int main()
{
  boost::coroutines::attributes attr(false /*don't preserve FPU registers*/);
  generator gen(foo, attr);
  while (gen)
  {
    std::cout << gen.get() << std::endl;
    gen();
  }
  return 0;
};

I tried with gcc 4.8 and clang 3.3 on Mac OS X 10.8 and with gcc 4.8 on Linux (CentOS 6). I also tried with the latest Boost trunk (r85977) on Mac OS X 10.8.

Change History (3)

comment:1 by olli, 9 years ago

Resolution: invalid
Status: newclosed

parameter type for disabling FPU is not a bool - it is a enumeration. correct code: boost::coroutines::attributes attr(boost::coroutines::fpu_not_preserved /*don't preserve FPU registers*/);

comment:2 by Alexandre Hamez <alexandre.hamez@…>, 9 years ago

OK, thanks. In this case, this is a bug in the documentation. It is stated that the parameter type is a bool (http://www.boost.org/doc/libs/1_54_0/libs/coroutine/doc/html/coroutine/attributes.html), not a enumeration.

in reply to:  2 comment:3 by olli, 9 years ago

Replying to Alexandre Hamez <alexandre.hamez@…>:

OK, thanks. In this case, this is a bug in the documentation. It is stated that the parameter type is a bool (http://www.boost.org/doc/libs/1_54_0/libs/coroutine/doc/html/coroutine/attributes.html), not a enumeration.

OK - I've fixed it in the docu, thx.

Note: See TracTickets for help on using tickets.