diff --git a/internal/engine/wazevo/wazevoapi/debug_options.go b/internal/engine/wazevo/wazevoapi/debug_options.go index 1a5c0bc376..0833010124 100644 --- a/internal/engine/wazevo/wazevoapi/debug_options.go +++ b/internal/engine/wazevo/wazevoapi/debug_options.go @@ -33,7 +33,7 @@ const ( PrintRegisterAllocated = false PrintFinalizedMachineCode = false PrintMachineCodeHexPerFunction = printMachineCodeHexPerFunctionUnmodified || PrintMachineCodeHexPerFunctionDisassemblable //nolint - printMachineCodeHexPerFunctionUnmodified = false + printMachineCodeHexPerFunctionUnmodified = true // PrintMachineCodeHexPerFunctionDisassemblable prints the machine code while modifying the actual result // to make it disassemblable. This is useful when debugging the final machine code. See the places where this is used for detail. // When this is enabled, functions must not be called. diff --git a/internal/integration_test/fuzzcases/fuzzcases_test.go b/internal/integration_test/fuzzcases/fuzzcases_test.go index 093467c92e..2259868fa9 100644 --- a/internal/integration_test/fuzzcases/fuzzcases_test.go +++ b/internal/integration_test/fuzzcases/fuzzcases_test.go @@ -986,3 +986,15 @@ func Test2037(t *testing.T) { require.Equal(t, []uint64{0x0, 0x0, 0xbbbbbbbbbbbbbbbb, 0xbbbbbbbbbbbbbbbb, 0xcb6151c8d497b060, 0xbbbbbbbbbbbbbbbb, 0xe71c3971a22b233b, 0xa0a0a0a0a0a0a0a, 0x0, 0xfffffffb00000030, 0x0, 0x6c6cbbbbbbbbbbbb, 0xfeb44590ef194fa2, 0x1313131313131313, 0x1898a98e9daf4f22, 0xf8f8f8f80a0a0aa0, 0x6c6c6c6c6c6cf1f8, 0x6c6c6c6c6c6c6c6c, 0x9abbbbbbbbbbbb6c, 0x9a9ad39a9a9a9a9a}, res) }) } + +func Test2040(t *testing.T) { + if !platform.CompilerSupported() { + return + } + run(t, func(t *testing.T, r wazero.Runtime) { + mod, err := r.Instantiate(ctx, getWasmBinary(t, "2040")) + require.NoError(t, err) + _, err = mod.ExportedFunction("").Call(ctx, make([]uint64, 1)...) + require.NoError(t, err) + }) +} diff --git a/internal/integration_test/fuzzcases/testdata/2040.wasm b/internal/integration_test/fuzzcases/testdata/2040.wasm new file mode 100644 index 0000000000..d59c224055 Binary files /dev/null and b/internal/integration_test/fuzzcases/testdata/2040.wasm differ diff --git a/internal/integration_test/fuzzcases/testdata/2040.wat b/internal/integration_test/fuzzcases/testdata/2040.wat new file mode 100644 index 0000000000..648280b546 --- /dev/null +++ b/internal/integration_test/fuzzcases/testdata/2040.wat @@ -0,0 +1,21 @@ +(module + (type (;0;) (func (param i32))) + (func (;0;) (type 0) (param i32) + i32.const 988345840 + f32.convert_i32_s + global.get 0 ;;f32.const 0x1.c8c8c8p+73 + f32.max + f32.const nan (;=nan;) + i32.const 1 + select + i32.reinterpret_f32 + i32.const 0 ;; global.get 1 + i32.xor + global.set 2) ;; global.set 1 makes no difference + (global (;0;) f32 (f32.const 0x1.c8c8c8p+73 (;=1.68524e+22;))) + (global (;1;) (mut i32) (i32.const 0)) + (global (;2;) (mut i32) (i32.const 1000)) + (export "" (func 0)) + (export "1" (global 0)) + (export "2" (global 1)) + (data (;0;) ""))