Open
Description
Defining these types as function parameters can lead to this issue:size_t、intptr_t、long、void*
The wasm compiler defines size_t as 32-bit,but the aot runtime compile with msvc_x86_64,the size_t is 64-bit。
If we define a function in wasm with size_t param:
foo(size_t a, size_t b, size_t c, size_t d, size_t e) // size_t as 32-bit
and it will call into aot runtime:
aot_foo(size_t a, size_t b, size_t c, size_t d, size_t e) // size_t as 64-bit
The program may crash。
The reason is due to stack imbalance, especially for functions with more than 4 parameters, because the convention of MSVC is that the first 4 parameters are passed through registers, and the 5th parameter starts to be passed through the stack。
Metadata
Metadata
Assignees
Labels
No labels
Activity