mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-19 21:19:31 +02:00
+ new test for in64 value parameter push inlined
This commit is contained in:
parent
df392602a9
commit
42035e7283
@ -43,6 +43,8 @@ Inline ................ tinline1.pp tests recursive inlining, inlining
|
||||
a procedure multiple times and
|
||||
inlining procedures in other
|
||||
inline procedures.
|
||||
tinlin64.pp tests for a problem in pushing 64bit parameters
|
||||
by value.
|
||||
TypeInfo .............. trtti2.pp test the function system.typeinfo
|
||||
trtti3.pp tests the procedure system.finalize
|
||||
Resourcestrings ....... tresstr.pp tests a simple resource string
|
||||
|
40
tests/test/tinlin64.pp
Normal file
40
tests/test/tinlin64.pp
Normal file
@ -0,0 +1,40 @@
|
||||
program test_64bit_inline;
|
||||
|
||||
{$inline on}
|
||||
|
||||
function add (a,b : int64) : int64;
|
||||
begin
|
||||
add:=a+b;
|
||||
end;
|
||||
|
||||
function inlineadd (a,b : int64) : int64; inline;
|
||||
begin
|
||||
inlineadd:=a+b;
|
||||
end;
|
||||
|
||||
|
||||
var
|
||||
a, b, c, d : int64;
|
||||
|
||||
begin
|
||||
a:=50;
|
||||
b:=78;
|
||||
d:= -45;
|
||||
writeln('a (',a,') + b (',b,') = ',a+b);
|
||||
writeln('Using add function');
|
||||
writeln('a (',a,') + b (',b,') = ',add(a+1,b-1));
|
||||
writeln('Using add function inlined');
|
||||
writeln('a (',a,') + b (',b,') = ',inlineadd(a+1,b-1));
|
||||
c:=inlineadd(a+d,b-d);
|
||||
writeln('a (',a,') + b (',b,') = ',c);
|
||||
if (a+b<>add(a-1,b+1)) then
|
||||
begin
|
||||
writeln('Error in function with int64 args');
|
||||
Halt(1);
|
||||
end;
|
||||
if (a+b<>inlineadd(a+1,b-1)) then
|
||||
begin
|
||||
writeln('Error in inlined function with int64 args');
|
||||
Halt(1);
|
||||
end;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user