summaryrefslogtreecommitdiff
path: root/compiler/ncgld.pas
diff options
context:
space:
mode:
authorjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-11-26 22:27:35 +0000
committerjonas <jonas@3ad0048d-3df7-0310-abae-a5850022a9f2>2018-11-26 22:27:35 +0000
commit960fa8b8e76d7f4536d3d7ecf0650a5060e7cc7b (patch)
treedba10aa1839e34e49720c4847bba93c59bf67e7d /compiler/ncgld.pas
parentfcda8cd923b137e38d56f44cffdc86ab91b260f9 (diff)
downloadfpc-960fa8b8e76d7f4536d3d7ecf0650a5060e7cc7b.tar.gz
* cap the assumed alignment of pass-by-reference parameters to the minimum of
their default alignment, the alignment of locals, globals and constants (so that we don't overestimate the alignment of global normal set constants to 32 bytes, while the maximum const alignment is often only 8 bytes) git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@40374 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'compiler/ncgld.pas')
-rw-r--r--compiler/ncgld.pas6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/ncgld.pas b/compiler/ncgld.pas
index a152b2ab14..445f079e5d 100644
--- a/compiler/ncgld.pas
+++ b/compiler/ncgld.pas
@@ -420,6 +420,7 @@ implementation
href : treference;
newsize : tcgsize;
vd : tdef;
+ alignment: longint;
indirect : boolean;
name : TSymStr;
begin
@@ -529,7 +530,10 @@ implementation
{ assume packed records may always be unaligned }
if not(resultdef.typ in [recorddef,objectdef]) or
(tabstractrecordsymtable(tabstractrecorddef(resultdef).symtable).usefieldalignment<>1) then
- location_reset_ref(location,LOC_REFERENCE,newsize,resultdef.alignment,[])
+ begin
+ alignment:=min(min(min(resultdef.alignment,current_settings.alignment.localalignmax),current_settings.alignment.constalignmax),current_settings.alignment.varalignmax);
+ location_reset_ref(location,LOC_REFERENCE,newsize,alignment,[]);
+ end
else
location_reset_ref(location,LOC_REFERENCE,newsize,1,[]);
hlcg.reference_reset_base(location.reference,voidpointertype,hregister,0,ctempposinvalid,location.reference.alignment,[]);