Is this expected behavior? If so, what is the reason why it is not possible to use the field of a record as control variable in a for loop?Yes, it is expected behavior and it is rooted in the fact that a variable used as the index in a "for" loop is not allowed to be modified inside the loop.
local variables (outside the reach of other program code.)
In this case, I'm not sure that the problem is whether the control variable is local or global.The problem is global vs local but, the compiler can only go so far to enforce the rule: "for" index variables cannot be modified by user code. Even though that's the rule, the compiler has many, hard to impossible to avoid, limitations when it comes to enforcing it.
The following example is identical to the previous one, except that the control variable is a free-standing integer, not an integer field in a record.A perfectly reasonable example but, when it comes to enforcing the rule "the index should not be modified by user code" there are problems with it. In a multi-threaded program, since the index is a global variable, there is nothing that prevents the other thread from modifying it. The solution is: "don't allow the index to be a global variable" but, fully enforcing it would cause the example you presented above to no longer compile, forcing the programmer to create a function with a local "T" variable in order to implement a trivial program. Not desirable since it is cumbersome.
In this case, no problem.
program Project1; var T : integer; begin for T:=1 to 10 do writeln(T); end.
In my first example, the control variable is not a record, but an integer field of a record, thus an ordinal variable.Nope, a field of a record is a mistake, unless you hardcast, which is also bad programming.