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

Jonas Maebe jonas at freepascal.org
Sun Mar 10 12:48:17 CET 2019

On 10/03/2019 11:40, Yuriy Sydorov wrote:
> 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.

That would be compiler bugs that need to be fixed. Ideally, the commit 
message would also have mentioned that :)

> 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.

If the architecture and OS support it, I see no reason to forbid it. 
It's always possible to add a hint about efficiency in case the size of 
the locals grows beyond offsets that can be embedded in a single 
instruction, although this hint would trigger already at 32KB of locals 
on e.g. PowerPC.


More information about the fpc-pascal mailing list