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 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…