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

Marco van de Voort marcov at stack.nl
Tue Jul 5 09:25:43 CEST 2005


> > Gerhard Scholz wrote:
> >
> >>
> >>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.

For cardinal IMHO not-a-bug?




More information about the fpc-devel mailing list