Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2024-01

inc(QWORD, BYTE) -> range check

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Martin Frb

https://www.freepascal.org/docs-html/rtl/system/inc.html
- says it operates on pointers
- also gives examples for unsigned types such as word

But can it be used to increment a QWORD?

       Inc(FAddress, (Opcode div FOwner.FLineInfo.LineRange) *
FOwner.FLineInfo.MinimumInstructionLength);

FAddress: QWord = $FFFFFFFF02B60000

All values in the expression are of type Byte. Though the question to ask may be what the result is cast too....
I know the result of the expression is 0 (zero).
From the assembler I can see that I passed the div and the multiplication.

And then I got
0000000100CBEC93 48B8FFFFFFFFFFFFFF7F     mov rax,$7FFFFFFFFFFFFFFF 0000000100CBEC9D 4839C2                   cmp rdx,rax 0000000100CBECA0 7605                     jbe +$05    # $0000000100CBECA7 NEXTLINE+1815 fpdbgdwarfdataclasses.pas:4556 0000000100CBECA2 E8998535FF               call -$00CA7A67    # $0000000100017240 $fpc_rangeerror system.inc:801

which calls range check.

For all I can tell it checks the value of FAddress. But why does it check it against High(Int64) ?

It is a QWord.

FPC 3.2.3 from Dec 2023

Reply by email