I am continuing to struggle with some code that compiles and runs as intended using gpc-20020502 based on gcc 2.95.2 that I am now trying to get it running with gpc-20060325 based on gcc-3.4.4.
It appears the packing of records has changed. The following test program produces different answers with the different compilers
Program mltest06; Const MaxName=49; MaxClas=40; MaxChel=120;
Type TCompr=Packed Record Name:String(Maxname); Class:1..Maxclas; Awel:Set of 1..MaxChel; Rlate,Rtime:Integer; RetirementControl:Integer; PerformanceIndex:Integer; END;
Var Compr:TCompr;
Begin Writeln('Size of Compr =',Sizeof(Compr)); Writeln('Size of Compr.Name =',BitSizeof(Compr.Name)); Writeln('Size of Compr.Class =',BitSizeof(Compr.Class)); Writeln('Size of Compr.Awel =',BitSizeof(Compr.awel)); Writeln('Size of Compr.Rlate =',BitSizeof(Compr.Rlate)); Writeln('Size of Compr.Rtime =',BitSizeof(Compr.Rtime)); Writeln('Size of Compr.RetirementControl=',BitSizeof(Compr.RetirementControl)); Writeln('Size of Compr.PerformanceIndex =',BitSizeof(Compr.PerformanceIndex));
End.
20020502 20060325 Size of Compr =91 96 Size of Compr.Name =464 480 Size of Compr.Class =6 6 Size of Compr.Awel =128 128 Size of Compr.Rlate =32 32 Size of Compr.Rtime =32 32 Size of Compr.RetirementControl=32 32 Size of Compr.PerformanceIndex =32 32
Is there a command line option for gpc to obtain the previous behaviour with the newer version?
Martin Liddle wrote:
I am continuing to struggle with some code that compiles and runs as intended using gpc-20020502 based on gcc 2.95.2 that I am now trying to get it running with gpc-20060325 based on gcc-3.4.4.
It appears the packing of records has changed. The following test program produces different answers with the different compilers
<snip>
Is there a command line option for gpc to obtain the previous behaviour with the newer version?
AFAICS the change is:
2002-09-29 Frank Heckenbach frank@pascal.gnu.de
* gpc-decl.c: finish_struct(): align files, objects, strings and the types `TimeStamp' and `BindingType' even in packed records on systems with strict alignment requirements (chief38.pas)
There is no option to get old behaviour.