From f1b13dca1978022d2c2b6d39a15aa1f50917f09a Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 15 May 2011 13:47:26 +0000 Subject: [PATCH] * handle aligned assignments with size < sizeof(aint) properly, resolves #19355 git-svn-id: trunk@17468 - --- compiler/ncgld.pas | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas index f7d690ef4f..8b8fa8bf12 100644 --- a/compiler/ncgld.pas +++ b/compiler/ncgld.pas @@ -567,6 +567,7 @@ implementation otlabel,hlabel,oflabel : tasmlabel; href : treference; releaseright : boolean; + alignmentrequirement, len : aint; r : tregister; oldflowcontrol : tflowcontrol; @@ -777,13 +778,17 @@ implementation { TODO: HACK: unaligned test, maybe remove all unaligned locations (array of char) from the compiler} { Use unaligned copy when the offset is not aligned } len:=left.resultdef.size; - if (right.location.reference.offset mod sizeof(aint)<>0) or - (left.location.reference.offset mod sizeof(aint)<>0) or - (right.resultdef.alignment0) or + (left.location.reference.offset mod alignmentrequirement<>0) or + (right.resultdef.alignment0) and - (right.location.reference.alignment0) and - (left.location.reference.alignment