This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/41793] [4.3/4.4/4.5 Regression] About Long long bit field
- From: "shenrfen at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Oct 2009 15:46:15 -0000
- Subject: [Bug c/41793] [4.3/4.4/4.5 Regression] About Long long bit field
- References: <bug-41793-17793@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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