http://d.puremagic.com/issues/show_bug.cgi?id=1605


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |clugd...@yahoo.com.au




--- Comment #1 from Don <clugd...@yahoo.com.au>  2009-08-24 04:21:21 PDT ---
Actually this has nothing to do with switch or break. It only requires 'goto'
inside a while loop.
Reduced test case:

int Break()
{
    int i = 0;
    while (true) {   
        goto LABEL;
        LABEL:
        if (i!=0) return i;
        i = 27;
    }
    assert(i==27); // this passes, it did actually execute the loop.
    return 88; // unreachable
}

static assert(Break() == 27);
-----------
It's failing because the test for continuing to execute is wrong.
----
PATCH: interpret.c, Expression *WhileStatement::interpret(InterState *istate)

    if (e == EXP_BREAK_INTERPRET)
        return NULL;
-    if (e != EXP_CONTINUE_INTERPRET)
+    if (e && e != EXP_CONTINUE_INTERPRET)
        return e;
    }

    while (1)
    {
    e = condition->interpret(istate);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to