Преглед на файлове

* 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 години
родител
ревизия
d8542bf778
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      compiler/ncgutil.pas

+ 5 - 1
compiler/ncgutil.pas

@@ -1408,7 +1408,11 @@ implementation
         if current_procinfo.procdef.proccalloption in clearstack_pocalls then
           begin
             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));
           end
         else