Browse Source

* some safecall issues fixed

git-svn-id: branches/debug_eh@41406 -
florian 6 years ago
parent
commit
3c61bb9c5d
2 changed files with 11 additions and 2 deletions
  1. 5 1
      compiler/ncgflw.pas
  2. 6 1
      compiler/psabiehpi.pas

+ 5 - 1
compiler/ncgflw.pas

@@ -1354,7 +1354,11 @@ implementation
                    if-branch -> fc_inflowcontrol) }
                  if (tf_safecall_exceptions in target_info.flags) and
                     (current_procinfo.procdef.proccalloption=pocall_safecall) then
-                   handle_safecall_exception
+                   begin
+                     handle_safecall_exception;
+                     { we have to jump immediatly as we have to return the value of FPC_SAFECALL }
+                     hlcg.a_jmp_always(current_asmdata.CurrAsmList,oldCurrExitLabel);
+                   end
                  else
                    cexceptionstatehandler.handle_reraise(current_asmdata.CurrAsmList,excepttemps,finallyexceptionstate,exceptframekind);
                  { we have to load 0 into the execepttemp, else the program thinks an exception happended }

+ 6 - 1
compiler/psabiehpi.pas

@@ -465,7 +465,12 @@ implementation
         (current_procinfo as tpsabiehprocinfo).PushAction(action);
         (current_procinfo as tpsabiehprocinfo).PushLandingPad(action);
         if exceptframekind<>tek_except then
-          (current_procinfo as tpsabiehprocinfo).CurrentAction.AddAction(nil);
+          { no safecall? }
+          if use_cleanup(exceptframekind) then
+            (current_procinfo as tpsabiehprocinfo).CurrentAction.AddAction(nil)
+          else
+            { if safecall, catch all }
+            (current_procinfo as tpsabiehprocinfo).CurrentAction.AddAction(tobjectdef(-1));
 
         flowcontrol:=[fc_inflowcontrol,fc_catching_exceptions];
         if exceptframekind<>tek_except then