浏览代码

* fixed a div by zero error, when compiling a wasi-hosted compiler

Nikolay Nikolov 1 年之前
父节点
当前提交
da37fabc42
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      compiler/optcse.pas

+ 1 - 1
compiler/optcse.pas

@@ -737,7 +737,7 @@ unit optcse;
         if pi_do_call in current_procinfo.flags then
         if pi_do_call in current_procinfo.flags then
           max_int_regs_assigned:=length(paramanager.get_saved_registers_int(current_procinfo.procdef.proccalloption))
           max_int_regs_assigned:=length(paramanager.get_saved_registers_int(current_procinfo.procdef.proccalloption))
           { we store only addresses, so take care of the relation between address sizes and register sizes }
           { we store only addresses, so take care of the relation between address sizes and register sizes }
-            div (sizeof(PtrUInt) div sizeof(ALUUInt))
+            div max(sizeof(PtrUInt) div sizeof(ALUUInt),1)
           { heuristics, just use a quarter of all registers at maximum }
           { heuristics, just use a quarter of all registers at maximum }
             div 4
             div 4
         else
         else