[fpc-devel] unexpected results with succ() and fpc 2.4.0

Michael Van Canneyt michael at freepascal.org
Mon Jan 4 14:21:34 CET 2010



On Mon, 4 Jan 2010, Stefan Kisdaroczi wrote:

> hi list,
>
> the code below compiled and worked with fpc 2.2.x.
> With fpc 2.4.0 compilation fails with "Division by zero".
>
> ---- 8< ----
> program divsucc;
>
> begin
>  writeln( 256 DIV succ(255) );
> end.

Well, Succ(255) is probably evaluated as a byte, in which case it is zero,
and then when attempting to evaluate the DIV, the compiler indeed tries to 
divide by zero.

I don't know whether the behaviour of the compiler changed in this respect,
but it seems so ?

Michael.



More information about the fpc-devel mailing list