Explorar el Código

* better fix for #41412 I think as procedures can be tail call optimized as there is no result

florian hace 19 horas
padre
commit
26d1b0b778
Se han modificado 1 ficheros con 2 adiciones y 3 borrados
  1. 2 3
      compiler/opttail.pas

+ 2 - 3
compiler/opttail.pas

@@ -73,8 +73,7 @@ unit opttail;
               (n.nodetype=calln) and
               (tcallnode(n).procdefinition=p) and
               (not assigned(tcallnode(n).methodpointer)) and
-              (not has_copyback_paras(tcallnode(n))) and
-              (cnf_return_value_used in tcallnode(n).callnodeflags);
+              (not has_copyback_paras(tcallnode(n)));
             if result then
               usedcallnode:=tcallnode(n)
             else
@@ -124,7 +123,7 @@ unit opttail;
             calln,
             assignn:
               begin
-                if ((n.nodetype=calln) and is_optimizable_recursivecall(n)) or
+                if ((n.nodetype=calln) and is_optimizable_recursivecall(n) and is_void(n.resultdef)) or
                    ((n.nodetype=assignn) and is_resultassignment(tbinarynode(n).left) and
                    is_optimizable_recursivecall(tbinarynode(n).right)) then
                   begin