ficlVmInnerLoop hard loop
Brought to you by:
jsadler
In the if statement for the default switch case in ficlVmInnerLoop() in vm.c I had to change it to
if (((ficlInstruction)fw->code >= 0) && ((ficlInstruction)fw->code < ficlInstructionLast))
If fw->code is interpreted as negative, the "< ficlInstructionLast" will succeed even though fw->code is not in the range of the ficlInstruction enum 0..ficlInstructionLast. Wackiness ensues. This is probably compiler dependent or even command line option dependent: some compilers may treat an enum as unsigned, and may do so on a case by case basis depending on the range of values it sees for the enumeration.
Forgot to mention: this hangs in an endless loop when compiling the softcore because it hits an instruction value of 0xb769713a which has the sign bit set.
After perusing the code some more, that ">= 0" should probably be "> ficlInstructionInvalid" which would be consist with other similar checks elsewhere in the system. (Thanks for bearing with me.)
Patch file to generate my working ficl 4.1.0