mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-11 13:09:43 +02:00
* fixed alignment of bitpacked arrays of ordinals/enums: the prevous code
always returned the alignment of enum/ordinal by itself, which could be either bigger or smaller than what was required * for non-bitpacked regular arrays, always use the alignment of the elements instead of sometimes the natural alignment of the size of the elements (which can be different) git-svn-id: trunk@26019 -
This commit is contained in:
parent
dea947f87b
commit
c1cec52897
@ -3427,16 +3427,13 @@ implementation
|
|||||||
{ alignment of dyn. arrays doesn't depend on the element size }
|
{ alignment of dyn. arrays doesn't depend on the element size }
|
||||||
if (ado_IsDynamicArray in arrayoptions) then
|
if (ado_IsDynamicArray in arrayoptions) then
|
||||||
alignment:=size_2_align(sizeof(pint))
|
alignment:=size_2_align(sizeof(pint))
|
||||||
|
{ alignment is the target alignment for the used load size }
|
||||||
|
else if (ado_IsBitPacked in arrayoptions) and
|
||||||
|
(elementdef.typ in [enumdef,orddef]) then
|
||||||
|
alignment:=cgsize_orddef(int_cgsize(packedbitsloadsize(elepackedbitsize))).alignment
|
||||||
{ alignment is the alignment of the elements }
|
{ alignment is the alignment of the elements }
|
||||||
else if (elementdef.typ in [arraydef,recorddef,orddef,enumdef,floatdef]) or
|
|
||||||
((elementdef.typ=objectdef) and
|
|
||||||
is_object(elementdef)) then
|
|
||||||
alignment:=elementdef.alignment
|
|
||||||
{ alignment is the size of the elements }
|
|
||||||
else if not (ado_IsBitPacked in arrayoptions) then
|
|
||||||
alignment:=size_2_align(elesize)
|
|
||||||
else
|
else
|
||||||
alignment:=packedbitsloadsize(elepackedbitsize);
|
alignment:=elementdef.alignment
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user