diff --git a/src/kernel_services/ast_building/cil_builder.ml b/src/kernel_services/ast_building/cil_builder.ml
index b2767a1a9e131934f3e15fb13b508496e8715180..75b1683898f297a5fd421c9c038acb77ffcf566d 100644
--- a/src/kernel_services/ast_building/cil_builder.ml
+++ b/src/kernel_services/ast_building/cil_builder.ml
@@ -745,7 +745,10 @@ struct
     | Skip ->
       Cil_types.Skip (loc)
     | Assign (dest,src) ->
-      Cil_types.Set (build_lval ~loc dest, build_exp ~loc src, loc)
+      let dest' = build_lval ~loc dest
+      and src' = build_exp ~loc src in
+      let src' = Cil.mkCast ~newt:(Cil.typeOfLval dest') src' in
+      Cil_types.Set (dest', src', loc)
     | Call (dest,callee,args) ->
       let dest' = Option.map (build_lval ~loc) dest
       and callee' = build_exp ~loc callee