The reason I asked this is because I had a similar code to that (only difference was that -1 was a var) that compiled and ran as 90% expected (if the var was –1 it didn’t enter the loop) using Delphi6.
Few weeks ago I needed to add a few features to that application and I decided to do it with Delphi2006. The new futures I added worked fine but accompanied with it was a strange new bug..

Long story short, after several hours of debugging I found the problem with the for loop. It wasthe exact same code that worked fine in Delphi6, but in Delphi2006 I had to add an If statement before the loop!

It’s the first time I encountered this kind of behavior with for loops.. but hey, I’ve seen worse :?