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: 23 Oct 2009 01:52:04 -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 #7 from shenrfen at gmail dot com 2009-10-23 01:52 -------
What about the following case? There is not un-defined behavior.
PS :Could you please tell me the full name of DR #120 documents.
Thanks again.
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
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41793