From 11784cb76af3bdd83a034ed09d524eac48b39e02 Mon Sep 17 00:00:00 2001 From: joost Date: Sun, 5 Jan 2020 23:20:52 +0000 Subject: [PATCH] * Fixed safecall on win32 with -Ooregvar by making sure that $safecallresult is never stored in a register. git-svn-id: trunk@43868 - --- compiler/pparautl.pas | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/compiler/pparautl.pas b/compiler/pparautl.pas index 48909fe81f..1f1828a6fc 100644 --- a/compiler/pparautl.pas +++ b/compiler/pparautl.pas @@ -355,6 +355,15 @@ implementation { vo_is_funcret is necessary so the local only gets freed after we loaded its value into the return register } vs:=clocalvarsym.create('$safecallresult',vs_value,search_system_type('HRESULT').typedef,[vo_is_funcret]); + { do not put this variable in a register. The register which will be bound + to this symbol will not be allocated automatically. Which means it will + be re-used wich breaks the code. Besides this it is questionable if it is + an optimization if one of the registers is kept allocated during the complete + function, without ever using it. + (It would be better to re-write the safecall-support in such a way that this + variable it not needed at all, but that the HRESULT is set when the method + is finalized) } + vs.varregable:=vr_none; pd.localst.insert(vs); end;