[Nickle] bug: do-while doesnt

Keith Packard nickle@nickle.org
Fri, 06 Sep 2002 17:05:33 -0700

Around 16 o'clock on Sep 6, Bart Massey wrote:

> spins without incrementing k.  Probably a compiler bug: I'll
> let Keith sort it out :-).

It incremented k *once*, but then it did kinda start spinning.

Here's what the compiler was generating:

    LocalRefStore  ^ auto k (link 0 elt 0)
                                         int k = 0;
    Const            0
    LocalRef         auto k (link 0 elt 0)
    PostOp           +
    					 while (k < 10);
    Local          ^ auto k (link 0 elt 0)
    Const            10
    BinOp            <
    BranchTrue       branch L1 BranchModNone

As you can see, it's branching back to the wrong place.  It generated
a branch back to the 'continue' portion of the loop, rather than the top.

Easily fixed (and in CVS).