summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw17402a.pp
blob: 90a250b14e10a9c407a7bffbe591b9c61777f30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ %opt=-Ootailrec -Cs1000000 }

{$mode objfpc}
{ check if tail recursion optimization works, at least on 32 bit OSes }
function fac(i : int64) : int64;
  var
    a : array[0..100000] of longint;
  begin
    a[1]:=1;
    if i=0 then
      result:=1
    else
      result:=fac(i-1);
  end;

begin
  fac(4000000);
end.