[Bug c/41793] [4.3/4.4/4.5 Regression] About Long long bit field
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Fri Oct 23 02:53:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list