Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
2464 Discussions

Floating Point Exception from concurrent_vector

renorm
Beginner
374 Views
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
374 Views
Does this happen in a single threaded mode, or the application uses other TBB constructs too?
0 Kudos
Andrey_Marochko
New Contributor III
374 Views
Upon the second thought, the exception may happen because of copying garbage in Element::x and Element::y members.
0 Kudos
renorm
Beginner
374 Views
Looks like it is because of copying garbage. Default constructor which sets structure fields to 0 fixed the problem.
0 Kudos
Reply