Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Sub Main()
Dim CRC as UnsignedInteger
Dim DataCount as Integer
Dim BufferQ(1 to 100) as Byte
Dim ReceivedCRC as UnsignedInteger
DataCount = 10
CRC = CRC16(BufferQ(1), DataCount, &H8005, &Hffff, zxCRCRefIn Or zxCRCRefOut)
'ReceivedCRC = MakeWord(BufferQ(DataCount+1), BufferQ(DataCount + 2))
If CRC <> ReceivedCRC Then
'Do some work
End If
End Sub
Code details aside, the 'Internal Error' is indicative of a compiler issue.
Don_Kirby wrote:The code shown below returns the error message
Thanks for reporting this. We should still have time to figure out the solution and get it in before the final test run for the upcoming release.
Oddly, the error only occurs when compiling for native mode devices. Moreover, it's not related to the functions that you're using; the following simpler test case produces the same result.
The source of the problem has been located and a likely solution identified. You can work around the problem by putting a useful statement inside the If as shown in the test case below or by turning off optimization (use the compiler option optimize=no-optimize). Doing the latter shouldn't have a significant effect, if any, on the code size in native mode since the backend compiler will still be optimizing.