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: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Oct 2009 02:53:06 -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 #9 from pinskia at gcc dot gnu dot org 2009-10-23 02:53 -------
> unsigned long long a:2;
> unsigned long long b:40;
> unsigned long long c:22;
> unsigned long long a = t.a - 8;
t.a gets promoted to in as t.a is less precision than int. Which causes a sign
extend to happen and then converted into unsigned long long which causes
another sign extend.
> unsigned long long b = t.b - 8;
t.b has more precision than int so it does not get change and then it gets
promoted to unsigned long long.
> unsigned long long c = t.c - 8;
t.c is the same as t.a.
If you used 8u then it would have been converted into unsigned int rather than
int and become the same.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41793