Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
373 views
in Technique[技术] by (71.8m points)

Regex and openmp segmentation fault with g++ -fno-pic -no-pie. Why?

The following code causes Segmentation fault (core dumped):

#include <regex>
#include <omp.h>
using namespace std;

int main()
{
  regex expr("^(.[^ ]+\.)+(.+)$");
  return 0;
}

when compiled with:

g++-10 -fno-pic -no-pie -fopenmp tmp.cpp
g++-7 -fno-pic -no-pie -fopenmp tmp.cpp

while it works if compiled without the two flags -fno-pic -no-pie or removing -fopenmp:

g++-10 -fopenmp tmp.cpp
g++-7 -fopenmp tmp.cpp
g++-10 -fno-pic -no-pie tmp.cpp

Also g++-10 without those two flags will compile a dynamic library and not an executable it seems, so I am forced to use those.

I don't know much about this stuff so I am puzzled. Any help is welcome.

question from:https://stackoverflow.com/questions/65924630/regex-and-openmp-segmentation-fault-with-g-fno-pic-no-pie-why

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...