From: David Wells Date: Tue, 9 Apr 2024 23:13:57 +0000 (-0400) Subject: Explicitly open HDF5 and then clear its floating-point exceptions. X-Git-Tag: v9.6.0-rc1~384^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7763d743bdf6fd472adc887454ab83fd8de8f86d;p=dealii.git Explicitly open HDF5 and then clear its floating-point exceptions. New versions of HDF5 detect the floating-point environment by doing several things which trigger floating point exceptions, i.e., programs in the test suite now abort in H5open(). Work around that by explicitly setting up HDF5 before we turn on the 'abort on floating point exceptions' code. --- diff --git a/tests/tests.h b/tests/tests.h index 8aca9bdf8b..fc476f2f34 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -43,6 +43,10 @@ # include #endif +#if defined(DEAL_II_WITH_HDF5) +# include +#endif + // silence extra diagnostics in the testsuite #ifdef DEAL_II_DISABLE_EXTRA_DIAGNOSTICS @@ -846,6 +850,15 @@ struct EnableFPE EnableFPE() { #if defined(DEBUG) && defined(DEAL_II_HAVE_FP_EXCEPTIONS) +# if defined(DEAL_II_WITH_HDF5) + // Modern versions of HDF5 detect the floating-point environment by + // performing several operations which trigger floating-point exceptions. + // Hence we need to set up HDF5's global state before calling + // feenableexcept(). + const int ierr = H5open(); + AssertThrow(ierr == 0, ExcInternalError()); + feclearexcept(FE_ALL_EXCEPT); +# endif // enable floating point exceptions feenableexcept(FE_DIVBYZERO | FE_INVALID); #endif