Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2421 Discussions

SIGSEG / SIGBUS on catching a runtime_error when linked against tbb


My application is terminated with SIGSEG on access to ::what() when catching a "const runtime_error&" and with a SIGBUS when catching a "runtime_error". This happens even with the most minimal application

#include <stdexcept>
#include <iostream>

using namespace std;

int main(int argc, char **argv) {
	try {
		throw runtime_error("ERR");
	} catch (runtime_error err) {
		cerr << err.what() << endl;
	return 0;

The error only occurs when the application is linked against tbb (libtbb_debug.dylib as well as libtbb.dylib). Everything runs fine when I replace the runtime_error with a logic_error. Despite the weird behavior with the runtime_error, my application works perfectly fine and I can use parallel_reduce and parallel_for as expected.

When compiling the real application (not the snippet above) I get compiler warnings like the following

/opt/intel/tbb/include/tbb/parallel_reduce.h:167:17: warning: placement new constructing an object of type 'tbb::interface9::internal::start_reduce<tbb::blocked_range<long unsigned int>, erison::SegmentedReduce<0ul, erison::Table<long long unsigned int, double>, erison::Table<long long unsigned int, long long unsigned int, double> >::ReduceBody<erison::SegmentedReduceWorkloads::run(erison::Command&)::<lambda(auto:19&, const auto:20&, auto:21, auto:22)>, erison::SegmentedReduceWorkloads::run(erison::Command&)::<lambda(auto:23&, const auto:24&)> >, const tbb::auto_partitioner>' and size '64' in a region of type 'tbb::task* [2]' and size '15' [-Wplacement-new=]

I use gcc (--version returns g++-6 (Homebrew gcc 6.1.0) 6.1.0) with --std=c++14

Any hints on what is going on and how I can fix this would be greatly appreciated

0 Kudos
1 Reply

Apparently gcc 6.1.0 was the problem. I switched to llvm (Apple LLVM version 7.3.0 (clang-703.0.31)) and got rid of the crashes and placement new warnings.