Explorar o código

Fixed division by zero check

Taddeus Kroes %!s(int64=12) %!d(string=hai) anos
pai
achega
94299b18ac
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      phases/constprop.ml

+ 1 - 1
phases/constprop.ml

@@ -56,7 +56,7 @@ let eval = function
   | Binop (Mul, Const (FloatVal left, _), Const (FloatVal right, _), ann) ->
     Const (FloatVal (left *. right), ann)
 
-  | Binop (Div, Const (IntVal left, _), Const (IntVal right, _), ann) when right != 0l ->
+  | Binop (Div, Const (IntVal left, _), Const (IntVal right, _), ann) when right <> 0l ->
     Const (IntVal (left / right), ann)
   | Binop (Div, Const (FloatVal left, _), Const (FloatVal right, _), ann) ->
     Const (FloatVal (left /. right), ann)