http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59255
Bug ID: 59255 Summary: Segmentation fault with std::function and -fprofile-use Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: stepik-777 at mail dot ru Consider the following simple program: #include <functional> int main(int argc, char *argv[]) { std::function<int ()> f = []{ return 0; }; return 0; } I'm compiling it with these commands: g++ -std=c++11 -fprofile-generate -c test.cpp -o test.o g++ -std=c++11 -fprofile-generate -o test test.o ./test # execute to generate profiling data g++ -std=c++11 -fprofile-use -c test.cpp -o test.o #g++ -std=c++11 -fprofile-use -o test test.o This causes segfault when compiling with -fprofile-use: test.cpp: In destructor 'std::_Function_base::~_Function_base()': test.cpp:7:1: internal compiler error: Segmentation fault } ^ Tested with these two gcc versions: g++ (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1 g++.exe (rev0, Built by MinGW-W64 project) 4.8.2