From b6c670fa4e48fac30dee6f40f9de12df7f3cc853 Mon Sep 17 00:00:00 2001 From: xleroy Date: Sun, 17 Apr 2011 07:39:45 +0000 Subject: 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 --- cparser/StructAssign.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'cparser') 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 -- cgit v1.2.3