I was wondering why one program wasn't working: the contents of a for loop was being executed despite the start value being higher than the end value. If I changed the loop variable to be an integer, rather than of a type that's a subset of integers, it worked.
The attached test program works with TurboPascal 5.5 in DOSBOX.
Output with TP:
Integers
(1,2) (1,3) (1,4)
(2,1) (2,3) (2,4)
(3,1) (3,2) (3,4)
(4,1) (4,2) (4,3)
Tinys
(1,2) (1,3) (1,4)
(2,1) (2,3) (2,4)
(3,1) (3,2) (3,4)
(4,1) (4,2) (4,3)
Output when compiled with fpc under Linux, even with -Mtp command line option:
Integers
(1,2) (1,3) (1,4)
(2,1) (2,3) (2,4)
(3,1) (3,2) (3,4)
(4,1) (4,2) (4,3)
Tinys
(1,1) (1,2) (1,3) (1,4)
(2,1) (2,3) (2,4)
(3,1) (3,2) (3,4)
(4,1) (4,2) (4,3) (4,5)
.. i.e. the 'for' loops with the typed variables - but not integers - are always run once.