Placing entire object onto stack instead of using a reference
Original Reporter info from Mantis: Dmitry24
-
Reporter name: Dmitry
Original Reporter info from Mantis: Dmitry24
- Reporter name: Dmitry
Description:
When virtual method of an object is called an entire object seems to be placed onto stack causing abnormal stack eating. There is no such behaviour on FPC 3.0.4
Steps to reproduce:
{$M 16384,16384}
type
TObj = object
v: array [0..$2000] of Byte;
procedure Proc(depth: Integer);
procedure VProc; virtual;
end;
procedure TObj.VProc;
begin
end;
procedure TObj.Proc(depth: Integer);
begin
{stack is eaten here on the function entry}
if (depth < 64) then
Proc(depth+1);
{do not actually call the method since the obj is not initialized, just for minimal demonstration}
if (depth < 0) then
VProc;
end;
var
Obj: TObj;
begin
Obj.Proc(0);
writeln('Completed');
end.
--
There is runtimer error 202 when compiled in Debug mode with FPC 3.2.0rc1, and there are no errors when compiled with FPC 3.0.4