diff options
author | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-04-17 07:39:45 +0000 |
---|---|---|
committer | xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e> | 2011-04-17 07:39:45 +0000 |
commit | b6c670fa4e48fac30dee6f40f9de12df7f3cc853 (patch) | |
tree | aec3f6edda152e97d1237fc8add2f6f0c1ce4d7f /cparser/StructAssign.ml | |
parent | d9860475ac209eed6065cbb7b413f88a1bbde767 (diff) | |
download | compcert-b6c670fa4e48fac30dee6f40f9de12df7f3cc853.tar.gz compcert-b6c670fa4e48fac30dee6f40f9de12df7f3cc853.zip |
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/StructAssign.ml')
-rw-r--r-- | cparser/StructAssign.ml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cparser/StructAssign.ml b/cparser/StructAssign.ml index 925170bf..ae922670 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 |