Skip to content

scriptcomp: Do-while loop emits invalid opcodes when variable is declared but not initialized before loop #148

@nelak2

Description

@nelak2

Do while loops appear to fail when working with object iterators.

See the simplified example below:

void main()
{
    object oArea;
    
    do
    {
        oArea = OBJECT_INVALID;
        object oTarget = GetFirstPC();
        while (oTarget != OBJECT_INVALID)
        {
            if (GetIsObjectValid(oTarget))
            {
                oArea = GetArea(oTarget);
            }
            oTarget = GetNextPC();
        }
    }
    while (oArea != OBJECT_INVALID);
}

The error is INVALID OP CODE.

Tested on v89.8193.37-15

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions