VerifyError: Error #1030: Stack depth is unbalanced

[whisper]I’m not looking for a solution, (in fact, I could care less. It was just for a quick project and was never actually used anywhere. That error is very likely being caused by a bug in either the compiler or Flash Player). I just thought this was an interesting error which acts quite unexpectedly.[/whisper] :trout:

This code throws a runtime error “VerifyError: Error #1030: Stack depth is unbalanced.”

But this is no standard error! It starts off by listing the bytecode for the function or section that throws the error! (or maybe it’s more bytecode than that, I can’t tell) Very wonky indeed!

Note that the lone “this;” does NOT cause the error. It’s only when you stick that same code into a single for loop that it goes berzerk.

package
{
    import flash.display.Sprite;

    /**
     * Imagineered by Andreas Renberg (IQAndreas) December 2010
     *         http://iqandreas.blogspot.com/
     *         http://twitter.com/IQAndreas
     */
    public class TestBench_01 extends Sprite
    {
        public function TestBench_01()
        {            
            // NO ERROR:
            this;
            
            
            //Only when put inside of a for...loop does it throw an error!
            //  VerifyError: Error #1030: Stack depth is unbalanced. 1 != 0.
            for (var i:int = 0; i <= 0; i++)
            {
                this;
            }
        }
    }
}

Does anyone want to test this with different compiler or Flash Player version to see if they still get the error?

If anyone has any knowledge to why this is happening, I’d love to hear it.

But right now it’s 10AM and I’m going to bed, :snooze: