0xPolygonMiden / compiler

Compiler from MidenIR to Miden Assembly

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing `assert` in `intrinsics::mem::replace_element` in executing `get_inputs` test (`clk=451`) in VM

greenhat opened this issue · comments

After a workaround for #225, the next execution error at clk=451.

VM execution trace:

...
clk=435, op=dup0, fmp=1073741824, stack=[268435455, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=436, op=push(3), fmp=1073741824, stack=[3, 268435455, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=437, op=u32split, fmp=1073741824, stack=[0, 3, 268435455, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=438, op=movup2, fmp=1073741824, stack=[268435455, 0, 3, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=439, op=u32split, fmp=1073741824, stack=[0, 268435455, 0, 3, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=440, op=movup2, fmp=1073741824, stack=[0, 0, 268435455, 3, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=441, op=u32sub, fmp=1073741824, stack=[0, 0, 268435455, 3, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=442, op=swap, fmp=1073741824, stack=[0, 0, 268435455, 3, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=443, op=eqz, fmp=1073741824, stack=[1, 0, 268435455, 3, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=444, op=movup2, fmp=1073741824, stack=[268435455, 1, 0, 3, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=445, op=movup3, fmp=1073741824, stack=[3, 268435455, 1, 0, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=446, op=u32sub, fmp=1073741824, stack=[0, 268435452, 1, 0, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=447, op=swap, fmp=1073741824, stack=[268435452, 0, 1, 0, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=448, op=eqz, fmp=1073741824, stack=[0, 0, 1, 0, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=449, op=or, fmp=1073741824, stack=[0, 1, 0, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=450, op=and, fmp=1073741824, stack=[0, 0, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]
clk=451, op=or, fmp=1073741824, stack=[0, 268435455, 8, 0, 0, 0, 0, 0, 8, 1048576, 2048, 2048, 4294967284, 256, 0, 0, 4294967280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], memory=[(0, [0, 0, 0, 0]), (268435455, [0, 0, 0, 0])]

Here is the assert that blows up:

dup.0 push.3 lte assert

Plan to fix it:

  • Make sure we have tests for intrinsics::mem::store_sw;
  • Check the arguments for failing store_sw call;

Tasks

  1. 1 of 3
    greenhat

@bitwalker I have not found tests for intrinsics::mem::store_sw (or other ops) so I made #234 to add them.