Skip to content

[wasm] Interpreter: Local variable of function pointer type emits a warning Test.Prepare: Store local stack type mismatch 0 7 #65881

@radical

Description

@radical

Warning Test.Prepare: Store local stack type mismatch 0 7 from

g_warning("%s.%s: Store local stack type mismatch %d %d",
m_class_get_name (td->method->klass), td->method->name,
stack_type [mt], td->sp [-1].type);

  1. Put this code in src/mono/sample/wasm/console-v8-cjs/Program.cs
using System;
using System.Threading.Tasks;

public class Test
{
    public static async Task<int> Main(string[] args)
    {
        await Task.Delay(1);
        Prepare();
        return 0;
    }

    public unsafe static int Prepare()
    {
        delegate*<int> value = &Prepare;
        Console.WriteLine ($"value is {value == null}");
        return 5;
    }
}
  1. build: make build MSBUILD_ARGS="-p:TreatWarningsAsErrors=false"
  2. make run

Output:

console.debug: mono_wasm_runtime_ready fe00e07a-5519-4dfe-b35a-f867dbaf2e28
[MONO] Test.Prepare: Store local stack type mismatch 0 7
value is False

IIUC,

static int
can_store (int st_value, int vt_value)
{
if (st_value == STACK_TYPE_O || st_value == STACK_TYPE_MP)
st_value = STACK_TYPE_I;
if (vt_value == STACK_TYPE_O || vt_value == STACK_TYPE_MP)
vt_value = STACK_TYPE_I;
return st_value == vt_value;
}

.. this needs to map STACK_TYPE_F to STACK_TYPE_I too.

cc @lambdageek @BrzVlad

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions