[fpc-devel] bug: Inc(v,i)/Dec(v,i)

Peter Vreman peter at freepascal.org
Tue Jul 5 09:19:42 CEST 2005


> Gerhard Scholz wrote:
>
>>I've tried to submit this as a bug report, but after pressing on "Submit
>> bug"
>>nothing happens on http://www.freepascal.org/bugs/add.php3
>>
>>
>>
>>Inc ( v, i ) and Dec ( v, i ) produce rangecheck or overflow check with
>> {$r+,q+}
>>
>>Without checks the program runs corrctly.

Fixed

> <snip>
> This looks similar to bug 4152 that I submitted recently.

Bug 4152 is partly fixed. The compiletime error is removed. Only the
runtime overflow is left. That still needs to be decided how to handle it.
The following code also fails with an overflow

{$Q+}
var
  v : cardinal;
begin
  v:=100;
  inc(v,-1);
end.

The reason is that -1 is in fact an addition of $ffffffff resulting in the
carry flag being set and therefor an overflow.







More information about the fpc-devel mailing list