2
0
Эх сурвалжийг харах

* Do not remove a ret-in-param value from the stack by callee for safecall function when safecall exception check is enabled for a target.
The bug has been triggered only with the following conditions:
- tf_safecall_exceptions, tf_safecall_clearstack in target flags;
- fixed stack is used.
Since only the i386-android target meets these conditions atm, the bug has been unnoticed.

git-svn-id: trunk@32005 -

yury 9 жил өмнө
parent
commit
d8542bf778

+ 5 - 1
compiler/ncgutil.pas

@@ -1408,7 +1408,11 @@ implementation
         if current_procinfo.procdef.proccalloption in clearstack_pocalls then
         if current_procinfo.procdef.proccalloption in clearstack_pocalls then
           begin
           begin
             parasize:=0;
             parasize:=0;
-            if paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef) then
+            { 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.proccalloption=pocall_safecall) and
+                     (tf_safecall_exceptions in target_info.flags) ) and
+                   paramanager.ret_in_param(current_procinfo.procdef.returndef,current_procinfo.procdef) then
               inc(parasize,sizeof(pint));
               inc(parasize,sizeof(pint));
           end
           end
         else
         else