(p6i cc'd)

Okay, I've got this down to a dozen lines.  I'm using a build pulled from 
CVS two hours ago.  In case what's going on here isn't obvious, I'm 
shifting the first character off of S2 and putting it on the stack until S2 
is finally exhausted.  It's a boiled down version of my tokenizer.

         set S2, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
         set I5, 0    # Stack depth
TOKLOOP:
         length I0, S2
         eq I0, 0, DUMP
         substr S1, S2, 0, 1
         dec I0
         substr S2, S2, 1, I0

         inc I5
         savec S1
         branch TOKLOOP

DUMP:  eq I5, 0, BAIL
         restore S0
         print S0
         dec I5
         branch DUMP
BAIL:
         end

With the current build, even using your new savec opcode (or clone), the 
stack gets seriously messed up.   [In this example, the save opcode doesn't 
have the problem!  But in others it does.  I can't get anything to behave 
consistently.  Strings on the stack are just *broke*.]

So for the code given, the output instead of appearing as:

        ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjihgfedcba

You get the unlikely:

        ZYXWVUTSRQPONMLKJIHGFEDCBAzyxwvutsrqponmlkjZYXWVUTSR

(I think it only *appears* like the stack wrapped on itself, BTW.  In 
larger examples, garbage from elsewhere seems to pollute the stack instead 
of earlier entries like this.)  Dumping larger things on the stack makes 
the problem occur at shallower depths -- sometimes.  It really seems like 
things that have been hanging around on the stack for a while get mashed.

Sorry it took me so long to get this down to something concise.  I wish it 
were smaller, not so critical to me, and a little more consistent.

Reply via email to