From 0802edb7101071b56a56ea62bf6acd2e0425ffc1 Mon Sep 17 00:00:00 2001
From: Jonas Maebe <jonas@freepascal.org>
Date: Mon, 25 Nov 2019 07:55:57 +0000
Subject: [PATCH]   * fix Linux/i386 and Win32 after r43578

git-svn-id: trunk@43583 -
---
 compiler/i386/n386flw.pas | 1 +
 compiler/ncgutil.pas      | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/compiler/i386/n386flw.pas b/compiler/i386/n386flw.pas
index c7cac7a84f..1ef5c38a0b 100644
--- a/compiler/i386/n386flw.pas
+++ b/compiler/i386/n386flw.pas
@@ -375,6 +375,7 @@ procedure ti386tryfinallynode.pass_generate_code;
     emit_scope_end;
     if is_safecall then
       begin
+        current_asmdata.getjumplabel(safecalllabel);
         cg.a_jmp_always(current_asmdata.CurrAsmList,safecalllabel);
         { RTL handler will jump here on exception }
         cg.a_label(current_asmdata.CurrAsmList,exceptlabel);
diff --git a/compiler/ncgutil.pas b/compiler/ncgutil.pas
index 0de268b2fd..ebcf0dd965 100644
--- a/compiler/ncgutil.pas
+++ b/compiler/ncgutil.pas
@@ -767,7 +767,8 @@ implementation
             parasize:=0;
             { For safecall functions with safecall-exceptions enabled the funcret is always returned as a para
               which is considered a normal para on the c-side, so the funcret has to be pop'ed normally. }
-            if not current_procinfo.procdef.generate_safecall_wrapper then
+            if not current_procinfo.procdef.generate_safecall_wrapper and
+               paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef) then
               inc(parasize,sizeof(pint));
           end
         else