mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-05-29 20:42:52 +02:00
compiler: calculate offset of record fields in taddrnode also for bitpacked structures (Jonas comment in bug #0019357)
git-svn-id: trunk@23437 -
This commit is contained in:
parent
1b8369dd99
commit
fe338013a5
@ -587,9 +587,18 @@ implementation
|
|||||||
begin
|
begin
|
||||||
offset:=tabsolutevarsym(tloadnode(hp).symtableentry).addroffset;
|
offset:=tabsolutevarsym(tloadnode(hp).symtableentry).addroffset;
|
||||||
hp:=left;
|
hp:=left;
|
||||||
while assigned(hp) and (hp.nodetype=subscriptn) do
|
while assigned(hp)and(hp.nodetype=subscriptn) do
|
||||||
begin
|
begin
|
||||||
inc(offset,tsubscriptnode(hp).vs.fieldoffset);
|
hsym:=tsubscriptnode(hp).vs;
|
||||||
|
if tabstractrecordsymtable(hsym.owner).is_packed then
|
||||||
|
begin
|
||||||
|
{ can't calculate the address of a non-byte aligned field }
|
||||||
|
if (hsym.fieldoffset mod 8)<>0 then
|
||||||
|
exit;
|
||||||
|
inc(offset,hsym.fieldoffset div 8)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
inc(offset,hsym.fieldoffset);
|
||||||
hp:=tunarynode(hp).left;
|
hp:=tunarynode(hp).left;
|
||||||
end;
|
end;
|
||||||
if nf_typedaddr in flags then
|
if nf_typedaddr in flags then
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
program tw19357;
|
program tw19357;
|
||||||
type
|
type
|
||||||
TLvl0 = packed record
|
TLvl0 = bitpacked record
|
||||||
a,b: longword;
|
a,b: longword;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user