[Bug c/41793] [4.3/4.4/4.5 Regression] About Long long bit field
shenrfen at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Oct 22 15:46:00 GMT 2009
------- Comment #5 from shenrfen at gmail dot com 2009-10-22 15:46 -------
Thanks very much for all your reply.
But I also have another question, Why is the 3rd output 40bits?
int main()
{
struct s t = {1, 2, 3};
printf("0x%llx\n",(t.a-8));
printf("0x%llx\n",(t.b-8));
printf("0x%llx\n",(t.c-8));
}
the output is as following
0xfffffff9 (32 bit)
0xfffffffffa (40 bit)
0xfffffffffb (40 bit) // but why, here is also 40 bit.
And I have do another experience.
struct s
{
unsigned long long a:2;
unsigned long long b:40;
unsigned long long c:22;
};
int main()
{
struct s t = {1, 2, 3};
unsigned long long a = t.a - 8;
unsigned long long b = t.b - 8;
unsigned long long c = t.c - 8;
printf("0x%llx\n",a);
printf("0x%llx\n",b);
printf("0x%llx\n",c);
}
Tht output is :
0xfffffffffffffff9
0xfffffffffa
0xfffffffffffffffb
Could you please tell me the full name of DR #120 documents.
Thanks again.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41793
More information about the Gcc-bugs
mailing list