- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, I came across an issue with the ICC compiler (2015.1.133) on Linux when using throw in a secondary thread that was declared with noexcept:
#include <thread>void f1() { throw 1; } void f2() noexcept { f1(); } int main( int argc, char **argv ) { std::thread t(f2); t.join(); return 0; }
If you run it through icc & gdb (Kubuntu 12.04 & 16.04), you see an incomplete and incorrect stack trace:
# icc -v icc version 15.0.1 (gcc version 4.6.0 compatibility) # icc -g -pthread -std=gnu++0x -o test test2.cc # gdb test (gdb) r (gdb) bt #0 0x00007ffff70150d5 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff701883b in __GI_abort () at abort.c:91 #2 0x00007ffff783316d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007ffff78311d6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007ffff7831221 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x00007ffff7831236 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007ffff7830e92 in __cxa_call_unexpected () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #7 0x0000000000400f15 in f2 () at test.cc:7 ...
If you run it through gcc & gdb (Kubuntu 12.04 & 16.04), you see the complete and correct stack trace:
# gcc -v gcc version 4.6.4 (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) # g++ -g -pthread -std=c++0x -o test test2.cc # gdb test (gdb) r (gdb) bt #0 0x00007ffff73110d5 in __GI_raise (sig=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64 #1 0x00007ffff731483b in __GI_abort () at abort.c:91 #2 0x00007ffff7b2f16d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007ffff7b2d1d6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007ffff7b2c2c9 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x00007ffff7b2ca2b in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007ffff78c7013 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #7 0x00007ffff78c739b in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1 #8 0x00007ffff7b2d42b in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #9 0x0000000000400d4a in f1 () at test.cc:4 #10 0x0000000000400d53 in f2 () at test.cc:8 ...
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am having error when compiling your test case.
vahoang@orcsle100:/tmp$ gcc -g -pthread -std=gnu++0x -o test c.cc
c.cc:6: error: expected initializer before ânoexceptâ
c.cc: In function âint main(int, char**)â:
c.cc:11: error: âf2â was not declared in this scope
vahoang@orcsle100:/tmp$ cat c.cc
#include <thread>
void f1() {
throw 1;
}
void f2() noexcept {
f1();
}
int main( int argc, char **argv ) {
std::thread t(f2);
t.join();
return 0;
}
Regards,
Viet Hoang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please use g++ instead of gcc and use version 4.6 or higher.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks,
It looks like a bug to me. Can you please submit a ticket at https://supporttickets.intel.com/?
Regards,
Viet Hoang
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page