Skip to content

Commit 411921d

Browse files
authored
When linked in debug mode, there is a linker warning about function signature msimatch which looks like it should either have linked a completely broken executable or at best one that always crashes if this codepath is taken. However, due to strangeness the linked executable works correctly. We don't like warnings so we fix it anyways. emscripten-core/emscripten#27418
2 parents d40d817 + 71212e7 commit 411921d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

spy/libspy/src/operator.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ spy_operator$f32_pow(float x, float y) {
126126
spy_panic("ZeroDivisionError", "0.0 cannot be raised to a negative power",
127127
__FILE__, __LINE__);
128128
}
129-
if (x < 0.0f && isfinite(y) && y != truncf(y)) {
129+
// Use __builtin_isfinite instead of isfinite: workaround for
130+
// https://github.com/emscripten-core/emscripten/issues/27418
131+
// Note: We use multivalue abi when building for wasi/emscripten.
132+
// See also: spy/build/flags.py
133+
if (x < 0.0f && __builtin_isfinite(y) && y != truncf(y)) {
130134
spy_panic("ValueError", "math domain error", __FILE__, __LINE__);
131135
}
132136
return powf(x, y);

0 commit comments

Comments
 (0)