UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

Exception: Reentered block with different amount of vars on stack

Open tioalexis opened this issue 2 years ago • 2 comments

Describe the bug

/* EXCEPTION!
   System.Exception: Reentered block with different amount of vars on stack (Entry: 2, Actual Count: 0)
   at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block, List`1 tempvars, Stack`1 workQueue) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 1933
   at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2608
   at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3759
   at UndertaleModTool.UndertaleCodeEditor.<>c__DisplayClass30_1.<DecompileCode>b__1() in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModTool\Editors\UndertaleCodeEditor.xaml.cs:line 433
*/

Disassembly: https://paste.ee/p/Q3kDg Source data.win: https://kay-yu.itch.io/holocure

Reproducing steps

  1. Download game and open data.win
  2. Look for gml_Object_obj_AttackController_Other_10 under Code

Setup Details

Version 765cf57 (master) Windows 10

tioalexis avatar Jun 26 '22 12:06 tioalexis

hello I seem to have encountered similar Exception (Entry & Count values differ, though)

/* EXCEPTION!
   System.Exception: Reentered block with different amount of vars on stack (Entry: 0, Actual Count: 1)
   at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block, List`1 tempvars, Stack`1 workQueue) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 1943
   at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2618
   at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3769
   at UndertaleModTool.UndertaleCodeEditor.<>c__DisplayClass31_1.<DecompileCode>b__1() in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModTool\Editors\UndertaleCodeEditor.xaml.cs:line 456
*/

in my case it is caused by this peculiar Array access enclosed in a While loop

process = true;
array = array_create(0);
array[@ 0] = 3;
array[@ 1] = 5;

while (process>0) {
    process = false;
    if (++array[0] == 4) {
        x = 10;
    }
}

Exception log is from 674c5d8 but 0.4.0.4 & 0.3.5.8 also bug out bug_stack2.zip

themabus avatar Jul 26 '22 12:07 themabus

Is the June 2022 version of HoloCure still available? It seems the current download uses YYC and thus has no code for UTMT to fail on, and the original paste link is dead. (The second decompilation error with the while loop is still present, however.)

Jacky720 avatar Feb 20 '24 03:02 Jacky720