Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only clear FE_INVALID when that symbol is present on the system #4954

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion release_docs/RELEASE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,19 @@ Bug Fixes since HDF5-1.16.0 release
===================================
Library
-------
-
- Only clear FE_INVALID when that symbol is present on the system

When we initialize the floating-point types at library startup, it's
possible to raise floating-point exceptions when we check which things
are supported. Normally, we clear these floating-point exceptions via
feclearexcept(FE_INVALID), but FE_INVALID may not be present on all
systems. Specifically, this was reported as being a problem when using
Emscripten 3.1.68 to compile HDF5 1.14.5 to WebAssembly.

We've added an #ifdef FE_INVALID block around the exception clearing
code to correct this.

Fixes GitHub issue #4952


Java Library
Expand Down
6 changes: 5 additions & 1 deletion src/H5Tinit_float.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,13 @@ H5T__init_native_float_types(void)
#endif

done:
/* Clear any FE_INVALID exceptions from NaN handling */
/* Clear any FE_INVALID exceptions from NaN handling. FE_INVALID is C99/C11,
* but may not be present on all systems.
*/
#ifdef FE_INVALID
if (feclearexcept(FE_INVALID) != 0)
HSYS_GOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't clear floating-point exceptions");
#endif

/* Restore the original environment */
if (feupdateenv(&saved_fenv) != 0)
Expand Down
Loading