Skip to content

Commit a83adcc

Browse files
authored
libc-builtin: Fix function prototype for wasm_runtime_module_realloc (#3702)
Fix: ``` wamr/core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c:20:1: warning: type of 'wasm_runtime_module_realloc' does not match original declaration [-Wlto-type-mismatch] wamr/core/iwasm/common/wasm_runtime_common.c:3033:1: note: return value type mismatch wamr/core/iwasm/common/wasm_runtime_common.c:3033:1: note: type 'uint64' should match type 'uint32' wamr/core/iwasm/common/wasm_runtime_common.c:3033:1: note: 'wasm_runtime_module_realloc' was previously declared here wamr/core/iwasm/common/wasm_runtime_common.c:3033:1: note: code may be misoptimized unless '-fno-strict-aliasing' is used ```
1 parent 67fa155 commit a83adcc

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

core/iwasm/libraries/libc-builtin/libc_builtin_wrapper.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
void
1717
wasm_runtime_set_exception(wasm_module_inst_t module, const char *exception);
1818

19-
uint32
19+
uint64
2020
wasm_runtime_module_realloc(wasm_module_inst_t module, uint64 ptr, uint64 size,
2121
void **p_native_addr);
2222

@@ -683,9 +683,12 @@ calloc_wrapper(wasm_exec_env_t exec_env, uint32 nmemb, uint32 size)
683683
static uint32
684684
realloc_wrapper(wasm_exec_env_t exec_env, uint32 ptr, uint32 new_size)
685685
{
686+
uint64 ret_offset = 0;
686687
wasm_module_inst_t module_inst = get_module_inst(exec_env);
687688

688-
return wasm_runtime_module_realloc(module_inst, ptr, new_size, NULL);
689+
ret_offset = wasm_runtime_module_realloc(module_inst, ptr, new_size, NULL);
690+
bh_assert(ret_offset < UINT32_MAX);
691+
return (uint32)ret_offset;
689692
}
690693

691694
static void

0 commit comments

Comments
 (0)