summaryrefslogtreecommitdiff
path: root/cparser/StructAssign.ml
diff options
context:
space:
mode:
Diffstat (limited to 'cparser/StructAssign.ml')
-rw-r--r--cparser/StructAssign.ml8
1 files changed, 5 insertions, 3 deletions
diff --git a/cparser/StructAssign.ml b/cparser/StructAssign.ml
index 925170b..ae92267 100644
--- a/cparser/StructAssign.ml
+++ b/cparser/StructAssign.ml
@@ -118,9 +118,11 @@ let transf_assign env lhs rhs =
transf lhs rhs
with Exit ->
let by_words =
- match Cutil.sizeof env lhs.etyp with
- | Some n -> n mod !config.sizeof_ptr = 0
- | None -> false in
+ match Cutil.alignof env lhs.etyp, Cutil.sizeof env lhs.etyp with
+ | Some al, Some sz ->
+ al mod !config.sizeof_ptr = 0 && sz mod !config.sizeof_ptr = 0
+ | _, _->
+ false in
let (ident, ty) =
if by_words
then memcpy_words_ident env