[PicForth] More <0 strangeness

Alex Holden alex at linuxhacker.org
Tue Nov 23 21:09:27 CET 2004


This time I appear to have found a weird optimization bug with the <0 
word. I haven't yet checked to see if any of the the other comparison 
operators have a similar problem. <0 always puts -1 on the stack even 
when the TOS is positive if:
* Optimisation is turned on. disallow-optimizations makes it work correctly.
* The check is not in a separate word ie. 'dup <0 .' always emits -1 but 
the following works properly:
: test <0 . ;
dup test
* The <0 is followed by a call to another word, not an 'if'. ie. 'dup <0 
if [char] - emit else [char] + emit then' works as expected.

-- 
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer



More information about the PicForth mailing list