[Bug c++/43393] integral promotion of long bit-fields broken in g++ 4.4.0
rguenth at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Mar 17 10:47:00 GMT 2010
------- Comment #2 from rguenth at gcc dot gnu dot org 2010-03-17 10:47 -------
From
[3] ISO/IEC 14882-1998 [conv.prom] An rvalue for an integral bit-field can be
converted to an rvalue of type int if int can represent all the values of the
bit-field; otherwise, it can be converted to unsigned int if unsigned int can
represent all the values of the bit-field. If the bit-field is larger yet, no
integral promotion applies to it. If the bit-field has an enumerated type, it
is treated as any other value of that type for promotion purposes.
I read that t.f promotes to int. And that is exactly what the C++ frontend
does:
(void) printf ((const char *) "%lx %lx %lx\n", (long unsigned int) t.f, (long
unsigned int) ((int) t.f << 17), (long unsigned int) (((int) t.f << 17) >> 17))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43393
More information about the Gcc-bugs
mailing list