Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
Announcements
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
7782 Discussions

IntelC++ failed to compile thread_local extern std::stringstream::str(std::string) correctly

Liu__Bensong
Beginner
301 Views

I got a `segmentation fault` after compiling code below with icpc. However, clang++ and g++ compile it correctly.

// bug.cc
#include <sstream>
#include <string>

thread_local extern std::stringstream foo;

int main() {
    foo.str(std::string());
    return 0;
}
// lib.cc
#include <sstream>
thread_local std::stringstream foo;

Here's a screenshot while I'm reproducing the problem.

screenshot on error

Source files and the log is attached. My OS is latest ArchLinux, and other OS information is shown on the screenshot.

0 Kudos
1 Reply
Viet_H_Intel
Moderator
301 Views

Intel compiler version 18.0 doesn't support GCC 8.1. If you compile the test program on the system which had GCC 4.3 to 6.3 installed, then it should work.

Thanks,

Viet

Reply