Community
cancel
Showing results for 
Search instead for 
Did you mean: 
renorm
Beginner
73 Views

Floating Point Exception from concurrent_vector

I am getting underflow exception in release more, but not in debug mode. This is what causing the error:

[cpp]#include 
unsigned int fp_control_state = _controlfp(_EM_INEXACT, _MCW_EM);

struct Element
{
    std::vector data;
    double x, y;
};

tbb::concurrent_vector v;

// this fails with FP exception
Element& e = *v.push_back(Element());

// stepping inside with the debugger leads to the line 890 in concurent_vector.h
void init(const void *src) { for(; i < n; ++i) new( &array ) T(*static_cast(src)); }
[/cpp]


My platform is WinXP 32, Visual Studio 2008, tbb30_104oss with binaries downloaded from TBB website.

0 Kudos
3 Replies
Andrey_Marochko
New Contributor III
73 Views

Does this happen in a single threaded mode, or the application uses other TBB constructs too?
Andrey_Marochko
New Contributor III
73 Views

Upon the second thought, the exception may happen because of copying garbage in Element::x and Element::y members.
renorm
Beginner
73 Views

Looks like it is because of copying garbage. Default constructor which sets structure fields to 0 fixed the problem.
Reply