Fix undefined behaviour caused by uncaught exceptions in OMP section

An OpenMP parallel section must have a single entry and a single point
of exit. Leaving such a section by throwing an exception is undefined.
This patch fixes this by catching possible exceptions on the parallel
section and throwing right we left it.
This commit is contained in:
David Tellenbach
2020-10-02 00:41:01 +02:00
parent b933946d63
commit 9f202c6f1e
2 changed files with 12 additions and 4 deletions

View File

@@ -109,5 +109,7 @@ void memoryleak()
void test_exceptions()
{
CALL_SUBTEST( memoryleak() );
EIGEN_TRY {
CALL_SUBTEST( memoryleak() );
} EIGEN_CATCH(...) {}
}