https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68771
--- Comment #8 from Daniel Vollmer <zerolo at gmail dot com> --- Using g++-7.4.0 I'm now seeing the following: - Step 1) (the compilation with "-flto -fprofile-generate") still works, including the visibility warnings mentioned in Comment #2, in particular ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_FaceBasedMeshPreprocessingArguments.cpp.lto_priv.203' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans0.ltrans.o' to global weak symbol '__ZGVZNK4flis4Para9ValueNodeIbE11GetNodeTypeB5cxx11EvE1s' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans0.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_CommunicationBuffersBase.cpp.lto_priv.211' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans6.ltrans.o' to global weak symbol '__ZGVZN4flis9Threading19BroadcastFromMasterImEEvPT_mE4bufs' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans6.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_GroupNode.cpp.lto_priv.227' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans8.ltrans.o' to global weak symbol '__ZGVZNK4flis4Para10ChoiceNodeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE11GetNodeTypeEvE1s' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans8.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_DiscriminatedGroupNode.cpp.lto_priv.225' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans8.ltrans.o' to global weak symbol '__ZGVZNK4flis4Para10ChoiceNodeINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE11GetNodeTypeEvE1s' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans8.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_Instantiations.cpp.lto_priv.207' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans15.ltrans.o' to global weak symbol '__ZGVZNK4flis7Reducer3MinIdEEvPT_mE6shared' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans15.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_DistanceFromSurfaceElement.cpp.lto_priv.241' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans16.ltrans.o' to global weak symbol '__ZZN5Eigen8internal20manage_caching_sizesENS_6ActionEPlS2_E13m_l2CacheSize' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans4.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_Preprocessor.cpp.lto_priv.239' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans16.ltrans.o' to global weak symbol '__ZZN5Eigen8internal20manage_caching_sizesENS_6ActionEPlS2_E13m_l2CacheSize' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans4.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_InnermostTimeIntegrationBase.cpp.lto_priv.263' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans19.ltrans.o' to global weak symbol '__ZGVZNK4flis7Reducer9BitWiseOrImEEvPT_mE6shared' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans19.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_DiscretizationSelectionPara.cpp.lto_priv.249' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans23.ltrans.o' to global weak symbol '__ZGVZNK4flis4Para9ValueNodeIiE11GetNodeTypeB5cxx11EvE1s' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans23.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_DiscretizationParaBase.cpp.lto_priv.248' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans23.ltrans.o' to global weak symbol '__ZGVZNK4flis4Para9ValueNodeIiE11GetNodeTypeB5cxx11EvE1s' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans23.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. ld: warning: direct access in function '__GLOBAL__sub_I_65535_0_DiscretizationFactory.cpp.lto_priv.247' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans23.ltrans.o' to global weak symbol '__ZGVZNK4flis4Para9ValueNodeIiE11GetNodeTypeB5cxx11EvE1s' from file '/var/folders/02/yl3m8d4d0397mk6dxn6dpcqw0000gp/T//ccf8A4Wl.ltrans23.ltrans.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings. - Step 2 now no longer hangs, the Python extensions exits successfully and seems to generate / write profile data. The code executed to generate the profiles is multi-threaded. - Step 3 now fails (during "compilation" of the .cpp files) for at least one file with the following error: src/LinearSolver/InstantiationJacobi6.cpp: In member function 'flis::IndexedSubset<unsigned int>::Loop<flucs::BlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6>, flucs::SparseMatrixIndexMapping<true, unsigned int> >::MultiplyAdd(flis::ThreadedCommunicationContext&, flis::Reducer const&, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int> const&, double, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int> const&, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int>&) const::{lambda(unsigned int)#1}>(flucs::BlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6>, flucs::SparseMatrixIndexMapping<true, unsigned int> >::MultiplyAdd(flis::ThreadedCommunicationContext&, flis::Reducer const&, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int> const&, double, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int> const&, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int>&) const::{lambda(unsigned int)#1} const&) constvoid': src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: profile data is not flow-consistent } // end namespace flucs ^ src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 8-11 thought to be -12264 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 8-9 thought to be 1624310 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of iterations for basic block 11 thought to be -12264 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 11-1 thought to be -12264 src/LinearSolver/InstantiationJacobi6.cpp: In member function 'flis::IndexedSubset<unsigned int>::Loop<flucs::LinearSolverJacobi<flucs::BlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6>, flucs::SparseMatrixIndexMapping<true, unsigned int> > >::Solve(flis::ThreadedCommunicationContext&, flis::Reducer const&, double, flis::BlockMatrixInterface const&, flis::BlockVectorInterface const&, flis::BlockVectorInterface&)::{lambda(unsigned int)#2}>(flucs::LinearSolverJacobi<flucs::BlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6>, flucs::SparseMatrixIndexMapping<true, unsigned int> > >::Solve(flis::ThreadedCommunicationContext&, flis::Reducer const&, double, flis::BlockMatrixInterface const&, flis::BlockVectorInterface const&, flis::BlockVectorInterface&)::{lambda(unsigned int)#2} const&) constvoid': src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: profile data is not flow-consistent src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 8-11 thought to be -11356 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 8-9 thought to be 587466 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of iterations for basic block 11 thought to be -11356 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 11-1 thought to be -11356 src/LinearSolver/InstantiationJacobi6.cpp: In member function 'flucs::BlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6>, flucs::SparseMatrixIndexMapping<true, unsigned int> >::MultiplyAdd(flis::ThreadedCommunicationContext&, flis::Reducer const&, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int> const&, double, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int> const&, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int>&) const': src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: profile data is not flow-consistent src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 16-17 thought to be 1075 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 16-18 thought to be -4 src/LinearSolver/InstantiationJacobi6.cpp: In member function 'flucs::BlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6>, flucs::SparseMatrixIndexMapping<true, unsigned int> >::MultiplyAdd(flis::ThreadedCommunicationContext&, flis::Reducer const&, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int> const&, double, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int> const&, flucs::BlockVector<Eigen::Matrix<double, 6, 1, 0, 6, 1>, unsigned int>&) const::{lambda(unsigned int)#1}::operator()(unsigned int) const': src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: profile data is not flow-consistent src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 7-8 thought to be 1530361 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 7-10 thought to be -1462 src/LinearSolver/InstantiationJacobi6.cpp: In member function 'flis::IndexedSubset<unsigned int>::Loop<flucs::LinearSolverJacobi<flucs::BlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6>, flucs::SparseMatrixIndexMapping<true, unsigned int> > >::Solve(flis::ThreadedCommunicationContext&, flis::Reducer const&, double, flis::BlockMatrixInterface const&, flis::BlockVectorInterface const&, flis::BlockVectorInterface&)::{lambda(unsigned int)#1}>(flucs::LinearSolverJacobi<flucs::BlockMatrix<Eigen::Matrix<double, 6, 6, 0, 6, 6>, flucs::SparseMatrixIndexMapping<true, unsigned int> > >::Solve(flis::ThreadedCommunicationContext&, flis::Reducer const&, double, flis::BlockMatrixInterface const&, flis::BlockVectorInterface const&, flis::BlockVectorInterface&)::{lambda(unsigned int)#1} const&) constvoid': src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: profile data is not flow-consistent src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 8-11 thought to be -62 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 8-9 thought to be 40120 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of iterations for basic block 11 thought to be -62 src/LinearSolver/InstantiationJacobi6.cpp:21:1: error: corrupted profile info: number of executions for edge 11-1 thought to be -62 If I disable threading for the Profile generation (Step 2)), then the compilation in Step 3) seems to succeed, and I get a functioning result.