View Issue Details

IDProjectCategoryView StatusLast Update
0027480FPCCompilerpublic2015-02-16 20:12
ReporterMarladu Assigned ToFlorian  
Status resolvedResolutionno change required 
Product Version3.1.1 
Summary0027480: {$align} and {$packrecords} directives do nothing
Description Compiling the following code with trunk freepascal for win32, the field rec2.b should have an offset of 16 from start of record but has an offset of 4.
Steps To Reproduceprogram Project1;


{$align 16}{$packrecords 16}


 if (longint(@abc.b)-longint(@abc))<>16 then // this should be 16 but is 4
TagsNo tags attached.
Fixed in Revision
Attached Files



2015-02-16 19:56

administrator   ~0081142

No, the 3.1.1 behaviour is correct. Align 16 means only a maximum alignment of 16, since there is no type involved requiring such an alignment, the highest needed alignment is used.


2015-02-16 20:06

reporter   ~0081143

Last edited: 2015-02-16 20:06

View 2 revisions

But the field rec2.b is 16 byte in size, so from my understanding of the docs of $packrecords ("This means that the elements of a record which have size greater than n will be aligned on n byte boundaries.") I expected that field to have an offset of 16 from start of record.

 If that's really intended, then is the only way to guarantee to 16byte alignment for SSE data fields to manually align with padding data like this?




2015-02-16 20:12

administrator   ~0081144

This is not a help/discussion forum. Please discuss such issues on the mailing lists.

Issue History

Date Modified Username Field Change
2015-02-16 19:53 Marladu New Issue
2015-02-16 19:56 Florian Note Added: 0081142
2015-02-16 19:56 Florian Status new => resolved
2015-02-16 19:56 Florian Resolution open => no change required
2015-02-16 19:56 Florian Assigned To => Florian
2015-02-16 20:06 Marladu Note Added: 0081143
2015-02-16 20:06 Marladu Status resolved => feedback
2015-02-16 20:06 Marladu Resolution no change required => reopened
2015-02-16 20:06 Marladu Note Edited: 0081143 View Revisions
2015-02-16 20:12 Florian Note Added: 0081144
2015-02-16 20:12 Florian Status feedback => resolved
2015-02-16 20:12 Florian Resolution reopened => no change required