[fpc-pascal] Error: Local variables size exceeds supported limit

Yuriy Sydorov jura at cp-lab.com
Sun Mar 10 11:40:08 CET 2019


On 10.03.2019 12:07, Jonas Maebe wrote:
> On 2019-03-10 10:22, Yuriy Sydorov wrote:
>> FYI on 64-bit Windows the stack size limit is hard coded to 1GB. The
>> same 1GB limit applies on 32-bit Windows. Probably Linux can be
>> configured for larger stack.
> 
> Linux needs to be specially configured to forbid a larger stack.
> 
>> But I agree with Jonas, that using huge local vars is pointless and inefficient.
>>
>> So it is not the FPC issue, but the library design issue.
> 
> I disagree. We should not break things unless it is required. On Win64 we should probably give an error when the stack 
> allocation size is larger than 1GB, but on other 64 bit platforms we should allow up to high(int64).

If I recall correctly, currently the compiler uses longints as stack offsets internally in several places. That's why 
the limit is 2GB even for 64-bit targets.

The issue in this tread is caused by the incorrect declaration of procedure's params. See my other answer. In this case 
2GB of stack is not needed at all.
I suppose there are no real world apps which require 2GB of stack for local vars or parameters. Even if we consider 
future apps it is useless to support 64-bit stack offsets for local vars of a single procedure.

Yuriy.



More information about the fpc-pascal mailing list