Maurice Lombardi wrote:
This is the smallest program which displays the bug
program bug;
var s:string[255]='';
begin s:=s+'a'; s:=s+'b'; end.
It works fine apparently. But by stepping with a debugger, I see that after each string concatenation the stack is increased by 16 bytes. No harm in usual programs since the stack is released at each exit of procedure
Yes, it's a known problem (GPC allocates a temp variable for the concatenation, but does it on a procedure scope, rather than locally in the expression). Has caused me and others some problems as well. I hope Peter can fix it sometime ... :-/
Frank