diff --git a/compiler/x86_64/cpupara.pas b/compiler/x86_64/cpupara.pas index 90e466e6f2..e98eb84527 100644 --- a/compiler/x86_64/cpupara.pas +++ b/compiler/x86_64/cpupara.pas @@ -1855,7 +1855,7 @@ unit cpupara; end; {$endif not LLVM} paraloc^.size:=def_cgsize(paraloc^.def); - { s64comp is pushed in an int register } + { s64comp/s64currency is pushed in an int register } if paraloc^.size=OS_C64 then begin paraloc^.size:=OS_64; @@ -1972,6 +1972,15 @@ unit cpupara; paraloc:=hp.paraloc[side].add_location; paraloc^.loc:=LOC_REFERENCE; paraloc^.def:=loc[locidx].def; + + { s64comp/s64currency are passed as integer types + (important for LLVM here) } + if paracgsize=OS_C64 then + begin + paraloc^.size:=OS_64; + paraloc^.def:=u64inttype; + end; + {Hack alert!!! We should modify int_cgsize to handle OS_128, however, since int_cgsize is called in many places in the compiler where only a few can already handle OS_128, fixing it diff --git a/tests/webtbs/tw40496.pp b/tests/webtbs/tw40496.pp new file mode 100644 index 0000000000..2ef1c99fdf --- /dev/null +++ b/tests/webtbs/tw40496.pp @@ -0,0 +1,29 @@ +program llvmccy5ParamTest; + +type + + TTestObjFail = object + constructor Init( + P1, P2, P3, P4: Currency; P5: Currency); + end; + +constructor TTestObjFail.Init( + P1, P2, P3, P4: Currency; P5: Currency); +begin + if p1<>1 then + halt(1); + if p2<>2 then + halt(2); + if p3<>3 then + halt(3); + if p4<>4 then + halt(4); + if p5<>5 then + halt(5); +end; + +var + TestObj : TTestObjFail; +begin + TestObj.Init(1, 2, 3, 4, 5); +end.