소스 검색

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

florian 19 시간 전
부모
커밋
26d1b0b778
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  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