What I've gathered is that with the following routine: function DoSomething: Integer; begin for Result:=alow to ahigh do if Something(Result) then exit; end;
The issue occurs if "Something(Result)" always returns False and the for-loop exits normally. While some languages and compilers will consistently set Result to "ahigh + 1" after the last cycle, this is not the case with Free Pascal, hence Result is undefined and the last value of R/EAX (which may or may not be False from the last call to "Something") becomes the function return. I'm not certain, but at the very least, if the variable used in the for-loop is still live afterwards (that is, it's read from before being written to again), a compiler warning should be thrown. If this already happens, then it might need to be modified to handle Result as a special case. Gareth aka. Kit
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel