gpc-20030323 released

Frank Heckenbach frank at g-n-u.de
Tue Mar 25 10:22:37 CET 2003


Gale Paeper wrote:

> CBFalconer wrote:
> > 
> > Adriaan van Os wrote:
> > > Frank Heckenbach wrote:
> > >
> > > > I've uploaded a new alpha to http://www.gnu-pascal.de/alpha/
> > > >
> > > > - New option `--maximum-field-alignment=N'
> > >
> > > Also as a compiler directive $maximum-field-alignment=N.

I don't mention this usually since generally all GPC specific
options work also as compiler directives.

> > > It works great, for example the following data structure
> > >
> > >   type word8  = cardinal(  8);
> > >          word16 = cardinal( 16);
> > >          word32 = cardinal( 32);
> > >          rec = record
> > >                       a, b, c: word8;
> > >                       d: word16;
> > >                       e: word32
> > >                end;
> > >
> > > returns different sizes (in bytes) for different aligments (in bits):
> > >
> > > N=0             size=12
> > > N=32    size=12
> > > N=16    size=10
> > > N=8             size=9
> > 
> > Huh?  By my reckoning everything is fouled.  N=32 should yield 20,
> > n=16 --> 12, n=8 seems ok.
> 
> I haven't looked into the actual implementation, but if the directive
> just ties into the back-end's stor-layout.c maximum_field_alignment
> useage (as discussed a while back in the pack struct thread), then the
> size and field offsets obtained with $maximum-field-alignment=N depends
> upon the target configuration settings.
> 
> If I'm not mistaken, the some of the target dependencies are:
> 
> 1. Natural integer size (e.g., 16, 32, 64, etc. bits)

(Which don't come into play in this example since the sizes are
explicitly given.)

> Hopefully the above will help clarify the intend useage of the
> $maximum-field-alignment directive. It isn't used to specify the minimum
> size for each specific field in a record; rather, it is more of a
> padding and inter-machine-word field splitting control for combinations
> of multiple, varying sized fields.

I think your explanation (and the numbers given by GPC) are correct.
That's why it's called *maximum* field alignment. ;-) BTW, I get the
same numbers on Linux/IA32, and I guess on many (but not necessarily
all) other targets ...

Frank

-- 
Frank Heckenbach, frank at g-n-u.de, http://fjf.gnu.de/, 7977168E
GPC To-Do list, latest features, fixed bugs:
http://www.gnu-pascal.de/todo.html
GPC download signing key: 51FF C1F0 1A77 C6C2 4482  4DDC 117A 9773 7F88 1707




More information about the Gpc mailing list