diff --git a/compiler/ppu.pas b/compiler/ppu.pas index de72af2584..6412b8688e 100644 --- a/compiler/ppu.pas +++ b/compiler/ppu.pas @@ -43,7 +43,7 @@ type {$endif Test_Double_checksum} const - CurrentPPUVersion=69; + CurrentPPUVersion=70; { buffer sizes } maxentrysize = 1024; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index 2eed5ddafd..3f368e2cff 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -2426,11 +2426,12 @@ implementation begin inherited ppuload(recorddef,ppufile); symtable:=trecordsymtable.create(0); - trecordsymtable(symtable).datasize:=ppufile.getaint; trecordsymtable(symtable).fieldalignment:=shortint(ppufile.getbyte); trecordsymtable(symtable).recordalignment:=shortint(ppufile.getbyte); trecordsymtable(symtable).padalignment:=shortint(ppufile.getbyte); trecordsymtable(symtable).usefieldalignment:=shortint(ppufile.getbyte); + { requires usefieldalignment to be set } + trecordsymtable(symtable).datasize:=ppufile.getaint; trecordsymtable(symtable).ppuload(ppufile); symtable.defowner:=self; isunion:=false; @@ -2486,11 +2487,11 @@ implementation procedure trecorddef.ppuwrite(ppufile:tcompilerppufile); begin inherited ppuwrite(ppufile); - ppufile.putaint(trecordsymtable(symtable).datasize); ppufile.putbyte(byte(trecordsymtable(symtable).fieldalignment)); ppufile.putbyte(byte(trecordsymtable(symtable).recordalignment)); ppufile.putbyte(byte(trecordsymtable(symtable).padalignment)); ppufile.putbyte(byte(trecordsymtable(symtable).usefieldalignment)); + ppufile.putaint(trecordsymtable(symtable).datasize); ppufile.writeentry(ibrecorddef); trecordsymtable(symtable).ppuwrite(ppufile); end; diff --git a/compiler/symtable.pas b/compiler/symtable.pas index 5d7f8e0b78..c54746b472 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -913,7 +913,9 @@ implementation procedure tabstractrecordsymtable.setdatasize(val: aint); begin _datasize:=val; - databitsize:=val*8; + if (usefieldalignment=bit_alignment) then + { can overflow in non bitpacked records } + databitsize:=val*8; end; {**************************************************************************** @@ -943,7 +945,8 @@ implementation storesize:=_datasize; storealign:=fieldalignment; _datasize:=offset; - databitsize:=offset*8; + if (usefieldalignment=bit_alignment) then + databitsize:=offset*8; { We move the ownership of the defs and symbols to the new recordsymtable. The old unionsymtable keeps the references, but doesn't own the diff --git a/compiler/utils/ppudump.pp b/compiler/utils/ppudump.pp index 1b79c2cf54..bf0060931f 100644 --- a/compiler/utils/ppudump.pp +++ b/compiler/utils/ppudump.pp @@ -1831,11 +1831,11 @@ begin ibrecorddef : begin readcommondef('Record definition'); - writeln(space,' DataSize : ',getaint); writeln(space,' FieldAlign : ',getbyte); writeln(space,' RecordAlign : ',getbyte); writeln(space,' PadAlign : ',getbyte); writeln(space,'UseFieldAlignment : ',getbyte); + writeln(space,' DataSize : ',getaint); if not EndOfEntry then Writeln('!! Entry has more information stored'); {read the record definitions and symbols}