From 93e0cd9e1adc8c7f3e6236903b99f1416df9242f Mon Sep 17 00:00:00 2001 From: svenbarth Date: Wed, 26 Dec 2018 22:59:36 +0000 Subject: [PATCH] * fix for Mantis #34496: correctly align stack so that SSE operations work correctly git-svn-id: trunk@40666 - --- .gitattributes | 1 + packages/rtl-objpas/src/x86_64/invoke.inc | 3 +-- tests/webtbs/tw34496.pp | 30 +++++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/webtbs/tw34496.pp diff --git a/.gitattributes b/.gitattributes index 5fa8054872..fb9d172c4e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -16445,6 +16445,7 @@ tests/webtbs/tw3443.pp svneol=native#text/plain tests/webtbs/tw34438.pp svneol=native#text/pascal tests/webtbs/tw3444.pp svneol=native#text/plain tests/webtbs/tw34442.pp svneol=native#text/plain +tests/webtbs/tw34496.pp svneol=native#text/pascal tests/webtbs/tw3456.pp svneol=native#text/plain tests/webtbs/tw3457.pp svneol=native#text/plain tests/webtbs/tw3460.pp svneol=native#text/plain diff --git a/packages/rtl-objpas/src/x86_64/invoke.inc b/packages/rtl-objpas/src/x86_64/invoke.inc index ba6516d168..d018d8b62f 100644 --- a/packages/rtl-objpas/src/x86_64/invoke.inc +++ b/packages/rtl-objpas/src/x86_64/invoke.inc @@ -36,9 +36,8 @@ asm .seh_endprologue { align stack size to 16 Byte } - add $15, aArgsStackSize - and $-16, aArgsStackSize sub aArgsStackSize, %rsp + and $-16, %rsp movq aArgsStackSize, %rax diff --git a/tests/webtbs/tw34496.pp b/tests/webtbs/tw34496.pp new file mode 100644 index 0000000000..51ac98d0c4 --- /dev/null +++ b/tests/webtbs/tw34496.pp @@ -0,0 +1,30 @@ +{ %TARGET = Win64 } + +program tw34496; + +{$MODE DELPHI} +{$WARN 5079 OFF} + +uses + TypInfo, + Rtti; + +procedure Test1(const d1, d2: Double); +begin + WriteLn(d1:0:2,' - ', d2:0:2); +end; + +procedure Test2(const d1, d2: Extended); +begin + WriteLn(d1:0:2,' - ', d2:0:2); +end; + +var + a, b: Double; +begin + a := 12.34; + b := 56.78; + Rtti.Invoke(@Test1, [a, b], ccReg, nil, True, False); + Rtti.Invoke(@Test2, [a, b], ccReg, nil, True, False); + //ReadLn; +end.