Warning on reference to a control variable after completion of a for loop
Summary
The Pascal language originally defined that a for loop's control variable had no defined value (i.e. contained junk) on completion of the statement. This was later modified in some implementations that the value was defined if the loop had been exited by a break or goto.
Forum discussion at https://forum.lazarus.freepascal.org/index.php/topic,68067.0.html resulted in a suggestion from Marco that it might be possible for the compiler to mark the control variable uninitialised in this context, Sven suggested that it was worth submitting as a feature request so as to be brought to the attention of the developer(s) interested in DFA etc. (Florian?).
I'd suggest that since the compiler is already fairly aggressive in warning about uninitialised variables, that it would probably be worth continuing the tradition and erring on the side of caution. A spurious warning can be suppressed with a pragma once reviewed manually, the compiler overlooking potentially-dodgy code can't.
System Information
All architectures, all targets.
Relevant 3rd party information
The thread was started by somebody porting a large body of code which has been developed using HP and later Borland compilers.