let expr_cast tyv tyr v =
    if Typ.equal tyv tyr then v else
    match object_of tyv, object_of tyr with
      | C_int i1 , C_int i2 ->
          M.V_int(i2,D.i_convert i1 i2 (int_of_value v))
      | C_float f1 , C_float f2 ->
          M.V_float(f2,D.f_convert f1 f2 (float_of_value v))
      | C_int _ , C_float f2 ->
          let z = int_of_value v in
          let r = F.real_of_integer z in
          M.V_float(f2,D.round f2 r)
      | C_float _ , C_int i2 ->
          let r = float_of_value v in
          let z = F.integer_of_real r in
          M.V_int(i2,M.D.modulo i2 z)
            (* TODO : specify non-modulo Cf. ISO-C 6.3.1.4 *)
      | C_pointer t1 , C_pointer t2 ->
          M.V_pointer(t2,M.cast_loc_to_loc t1 t2 (loc_of_value v))
      | C_pointer t1 , C_int i2 ->
          M.V_int (i2,M.cast_loc_to_int t1 (loc_of_value v)i2)
      | C_int i1 , C_pointer t2 ->
          M.V_pointer(t2, M.cast_int_to_loc i1 (int_of_value v) t2)
      | a,b ->
          WpLog.not_yet_implemented "cast from %a to %a"
            pp_object a pp_object b