summaryrefslogtreecommitdiff
path: root/cparser
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-04-17 07:39:45 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2011-04-17 07:39:45 +0000
commitb6c670fa4e48fac30dee6f40f9de12df7f3cc853 (patch)
treeaec3f6edda152e97d1237fc8add2f6f0c1ce4d7f /cparser
parentd9860475ac209eed6065cbb7b413f88a1bbde767 (diff)
Use memcpy_word only if alignment AND size are multiples of word size.
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1638 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'cparser')
-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