Menu

#19 ficlVmInnerLoop hard loop

open
nobody
crash & die (5)
5
2013-01-23
2011-12-14
No

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.

Discussion

  • Chip Overclock

    Chip Overclock - 2011-12-14

    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.

     
  • Chip Overclock

    Chip Overclock - 2011-12-14

    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.)

     
  • Chip Overclock

    Chip Overclock - 2011-12-14

    Patch file to generate my working ficl 4.1.0

     

Log in to post a comment.