[fpc-devel]Different behavior between Kylix and FPC

Johann Glaser Johann.Glaser at gmx.at
Tue Nov 11 00:15:00 CET 2003


Hi!

> I agree that FPC behavior is right here. But Borland compilers are doing that 
> for ages, and only recently they added a warning. I suppose they don't want 
> to fix it for compatibility with older programs, because it would break some 
> programs depending on that behavior.
> 
> I blame to myself because one stupid kylix program triggered this! ;-) I'm 
> recoding it again now.

Be especially careful when optimization is switched on. I had huge
problems a few years ago with Delphi. With optimisation turned on it
reversed the loop counter and counted from top downto 0.

The loop searched the maximum out of a few histogram bins. When there
have been two maxima equally full it gave another result as a reference
implementation (in Perl), which didn't optimize and thus always counted
from 0 to Max-1. Searched a few days for that. :-(

The moral from this story: it might even happen that the last loop
counter value can be the lower bound. Probably the FPC team should add a
few test benches to be sure not to reverse loop counters for
optimisation in some cases.

Bye
  Hansi

-- 
Johann Glaser   <Johann.Glaser at gmx.at>
   Vienna University of Technology
       Electrical Engineering 
____ http://www.johann-glaser.at/ ____





More information about the fpc-devel mailing list