@@ -102,10 +102,10 @@ module Generate (Target : Target_sig.S) = struct
102102 match from, into with
103103 | Number (Int Unnormalized), Number (Int Normalized) ->
104104 Arith. ((e lsl const 1l ) asr const 1l )
105- | ( Number (Int Ref ) | Top | Bot ) , Number (Int (Normalized | Unnormalized )) ->
106- Value. int_val e
107- | Number (Int (Unnormalized | Normalized )), ( Number ( Int Ref ) | Top ) ->
108- Value. val_int e
105+ | Number (Int ( Normalized | Unnormalized )) , Number (Int (Normalized | Unnormalized ))
106+ -> e
107+ | _ , Number (Int (Normalized | Unnormalized )) -> Value. int_val e
108+ | Number ( Int ( Unnormalized | Normalized )), _ -> Value. val_int e
109109 | _ -> e
110110
111111 let specialized_primitives =
@@ -830,10 +830,11 @@ module Generate (Target : Target_sig.S) = struct
830830 ~tag
831831 ~load: (fun x -> convert ~from: (get_var_type ctx x) ~into: Top (load x))
832832 (List. map ~f: (fun x -> `Var x) (Array. to_list a))
833- | Field (x , n , Non_float) -> Memory. field (load x) n
833+ | Field (x , n , Non_float) ->
834+ Memory. field (convert ~from: (get_var_type ctx x) ~into: Top (load x)) n
834835 | Field (x , n , Float) ->
835836 Memory. float_array_get
836- (load x)
837+ (convert ~from: (get_var_type ctx x) ~into: Top ( load x) )
837838 (Constant. translate (Int (Targetint. of_int_warning_on_overflow n)))
838839 | Closure _ ->
839840 Closure. translate
@@ -977,12 +978,12 @@ module Generate (Target : Target_sig.S) = struct
977978 (translate_expr ctx context x e)
978979 | Set_field (x , n , Non_float, y ) ->
979980 Memory. set_field
980- (load x)
981+ (convert ~from: (get_var_type ctx x) ~into: Top ( load x) )
981982 n
982983 (convert ~from: (get_var_type ctx y) ~into: Top (load y))
983984 | Set_field (x , n , Float, y ) ->
984985 Memory. float_array_set
985- (load x)
986+ (convert ~from: (get_var_type ctx x) ~into: Top ( load x) )
986987 (Constant. translate (Int (Targetint. of_int_warning_on_overflow n)))
987988 (load y)
988989 | Offset_ref (x , n ) ->
0 commit comments