[fpc-devel] "Ordinal expression expected" awkwardness

J. Gareth Moreton gareth at moreton-family.com
Wed Jul 19 19:42:33 CEST 2023


Hi everyone,

So I've come across a bit of awkwardness with the compiler.  I'm not 
sure if it's a well-defined rule that I've overlooked, but in a 
for-loop, you can't use a 64-bit control variable when compiling for 
i386-win32 (and presumably other 32-bit platforms), but you can under 
x86_64-win64.  In my case, the upper bound is a 64-bit variable (of type 
TConstExprInt... a record type in the compiler source), so downsizing is 
not ideal (although I will likely put in code that will error out if the 
upper bound is too large due to the risk of an malicious inputs causing 
said bound to equal 2^63 - 1 or 2^64 - 1).

My example aside, should it be that there's a situation where pure Free 
Pascal code can build on a 64-bit compiler but not a 32-bit compiler?  
IFpermitting 64-bit control variables is too difficult for 32-bit 
systems, should they be forbidden entirely or at least throw a warning?

Kit

P.S. As the title implies, trying to use a QWord or Int64 as a for-loop 
control variable under i386-win32 causes an "Ordinal expression 
expected" error, but compiles without incident on x86_64-win64.



More information about the fpc-devel mailing list