Version
main
Platform
Subsystem
ffi
What steps will reproduce the bug?
import{dlopen}from'node:ffi';const{ lib, functions }=dlopen(null,{abs: {arguments: ['i32'],return: 'i32'},});functioncall(value){returnfunctions.abs(value);}eval('%PrepareFunctionForOptimization(call)');call(0);call(0);eval('%OptimizeFunctionOnNextCall(call)');call(0);console.log(call(2**32));lib.close();Run with
$ node --no-warnings --experimental-ffi --allow-natives-syntax repro.js
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should throw ERR_INVALID_ARG_VALUE with Argument 0 must be an int32, as the generic FFI path does.
What do you see instead?
The optimized call accepts 2 ** 32, truncates it to zero, and returns 0
Additional information
No response
Version
main
Platform
Subsystem
ffi
What steps will reproduce the bug?
Run with
$ node --no-warnings --experimental-ffi --allow-natives-syntax repro.jsHow often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should throw
ERR_INVALID_ARG_VALUEwithArgument 0 must be an int32, as the generic FFI path does.What do you see instead?
The optimized call accepts
2 ** 32, truncates it to zero, and returns0Additional information
No response