Skip to content

Commit 1d05ff8

Browse files
authored
[embind] Fix and test for incorrect dynCalls signature (#24791)
Embind with C++ float types _and_ `-sDYNCALLS=1` (and by extension `-sASYNCIFY=1`) fails with: ``` Assertion failed: bad function pointer type - sig is not in dynCalls: 'iid' ``` This adds a one-char fix (from @RReverser) and adds a regression test. Fixes: #24762
1 parent 5c9c390 commit 1d05ff8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

system/include/emscripten/em_asm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void emscripten_asm_const_async_on_main_thread(
149149
// use std::tuple or std::integral_constant. Using C++11 features is only a
150150
// warning in modern Clang, which are ignored in system headers.
151151
template<typename, typename = void> struct __em_asm_sig {};
152-
template<> struct __em_asm_sig<float> { static const char value = 'd'; };
152+
template<> struct __em_asm_sig<float> { static const char value = 'f'; };
153153
template<> struct __em_asm_sig<double> { static const char value = 'd'; };
154154
template<> struct __em_asm_sig<char> { static const char value = 'i'; };
155155
template<> struct __em_asm_sig<signed char> { static const char value = 'i'; };

test/test_other.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3356,6 +3356,8 @@ def test_embind_no_raw_pointers(self, filename):
33563356
'o2_mem_growth': ['-O2', '-sALLOW_MEMORY_GROWTH', test_file('embind/isMemoryGrowthEnabled=true.cpp')],
33573357
'o2_closure': ['-O2', '--closure=1', '--closure-args', '--externs ' + shlex.quote(test_file('embind/underscore-externs.js')), '-sASSERTIONS=1'],
33583358
'strict_js': ['-sSTRICT_JS'],
3359+
# DYNCALLS tests the legacy native function API (ASYNCIFY implicitly enables DYNCALLS)
3360+
'dyncalls': ['-sDYNCALLS=1'],
33593361
})
33603362
def test_embind(self, *extra_args):
33613363
if '-sMEMORY64' in extra_args:

0 commit comments

Comments
 (0)