Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Serious FOR bug in latest dev build s1964
#9
ivorget Wrote:@Einar,
Actually the compiler does consider all three because it calls common_type twice. So hopefully your cases would be handled OK.

They are not.

Current implementation will think that FOR f=0 TO 254 STEP 2 should be UBYTE, because both 254 and 2 will fit into UBYTE. But it should be UINTEGER because comparing with 254+2 requires UINTEGER.

Your proposed change will think that FOR f=x TO -128 STEP 2 should be BYTE, because both -128+2=-126 and 2 will fit into BYTE. But it should be INTEGER.

Also it seems both current implementation and your proposed change will think that FOR f=255 TO 1 STEP -1 should be INTEGER, in order to accommodate all values 255, 1 and -1. But UBYTE would suffice.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)