UndertaleModTool icon indicating copy to clipboard operation
UndertaleModTool copied to clipboard

decompiler replaces expression with _temp_local_var_X

Open themabus opened this issue 3 years ago • 3 comments

Describe the bug

this GMS1.4 code:

for (var i = 0; i < 10; i++) {
    array[irandom(i)]++;
    x++;
}

gets decompiled as this nonworking code:

var i, _temp_local_var_1;
for (i = 0; i < 10; i++)
{
    array[_temp_local_var_1]++
    x++
}

Reproducing steps

script0 in attached data.win bug_decomp.zip

Setup Details

GMS1.4 674c5d8

themabus avatar Aug 07 '22 15:08 themabus

also this

repeat(x) {
    if hspeed
        y += 1;
    else
        y += 2;
    if (y>x) break;
}

gets misinterpreted by decompiler as this

var _temp_local_var_1;
_temp_local_var_1 = x
if (x <= 0)
{
}
else
{
    while (true)
    {
        if hspeed
            y += 1
        else
            y += 2
        if (y > x)
            break
        else
        {
            _temp_local_var_1 = (x - 1)
            if (x - 1)
                continue
        }
    }
}

script1 in attached data.win bug_decomp2.zip

themabus avatar Aug 07 '22 21:08 themabus

The latter is a known and, I believe, fixed bug with repeats and breaks. Can you try the bleeding edge?

Also, it's probably still possible to break it with more complicated breaks and continues. Just less likely to show up in a game.

Jacky720 avatar Aug 07 '22 21:08 Jacky720

yeah those both are from that bleeding edge from 18 days ago combined one

themabus avatar Aug 07 '22 21:08 themabus