fpc/tests/test/tinline8.pp
Jonas Maebe 49a2084ea0 * fixed calling inline functions (with exit statements) from inside
finally blocks
  * fixed the handling of function results of inlined functions with
    exit statements
  + test for the above two issues and for bug fixed in r8091
  * copy may_be_in_reg field inside ttempcreatenode.dogetcopy (allows
    some more temps which were needlessly forced into memory to be in
    registers)

git-svn-id: trunk@8108 -
2007-07-20 16:49:35 +00:00

64 lines
657 B
ObjectPascal

{$ifdef fpc}
{$mode objfpc}
{$inline on}
{$endif}
uses
sysutils;
var a: longint;
function f(l: longint): longint; inline;
var
l1,l2,l3: longint;
begin
result:=123456;
if (l > 10) then
exit;
result:=30;
for l1 := 1 to 10 do
for l2 := 1 to 100 do
;
result := 40;
for l3 := 1 to 10 do;
end;
procedure test;
var
l: longint;
begin
l:= f(a);
if (l<>123456) then
halt(1);
end;
procedure test2;
var
l: longint;
begin
try
finally
l:= f(a);
if (l<>123456) then
halt(1);
end;
end;
procedure inl2; inline;
begin
try
except on exception do ;
end
end;
begin
a:=20;
test;
test2;
inl2
end.