egcs and bitfields
Martin v. Loewis
martin@mira.isdn.cs.tu-berlin.de
Thu Mar 11 15:14:00 GMT 1999
> I sent this question to the list a few days ago but got
> no response. Can someone please help me out?
I think the problem with your previous report was that it was hard to
understand. I tried to come up with a program that demonstrates your
problem, and I got
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)
Anyway, when I run the program on i586-pc-linux-gnu, with
egcs-2.93.11, I get as output
0 56789
>From your explanation, I understand that this result is
ABI-compliant. So where is the problem?
Regards,
Martin
More information about the Gcc
mailing list