egcs and bitfields
David A. Greene
greened@eecs.umich.edu
Wed Mar 31 23:46:00 GMT 1999
Robert Lipe wrote:
>
> > struct baz { unsigned int a:2, b:4, c:32;} y;
> >
> > void foo()
> > {
> > y.c = 0x56789;
> > }
> >
> > int main()
> > {
> > unsigned int *b;
> > bzero(&y,sizeof(y));
> > foo();
> > b=&y;
> > printf("%x %x\n",b[0],b[1]);
> > }
> >
> > Is this the case you are talking about? Now, you claim that the SysV
> > ABI requires y.c to be at offset 4, right? (this is a claim I can't
> > verify since I don't have that specification)
>
> "System V ABI" is too vague for purposes of this discussion. Do you
> refer to the iBCS2 spec or the SVR4 ABI? I don't know that they differ
> in this regard, but it isn't an unreasonable question before tearing
> into large books.
Good question. The book I have here is the "System V ABI Intel386
Processor Supplement" put out by AT&T in 1991 (yes, I know it's old,
but it's all we've got). It is the SVR4 ABI. Please correct me
if there's a more up-to-date version I should be looking at.
> I think (but am no authority) that Linux uses substantially the SVR4 ABI
> but it does have some deviations.
Do you know what these deviations are? The devil is in the details. :)
-Dave
More information about the Gcc
mailing list