Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7650 Discussions

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

Liu__Bensong
Beginner
200 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
200 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