This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33819] [4.2/4.3 Regression] Miscompiled shift of C++ bitfield
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Dec 2007 12:59:23 -0000
- Subject: [Bug c++/33819] [4.2/4.3 Regression] Miscompiled shift of C++ bitfield
- References: <bug-33819-1313@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from jakub at gcc dot gnu dot org 2007-12-11 12:59 -------
Actually, I'm not sure what type the shifts are supposed to be done with,
because C++ says that only bitfields smaller than int/unsigned int are
promoted.
"An rvalue for an integral bit-field (9.6) 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."
So, is the shift supposed to be done in the base type of the bitfield, or in a
type with bitfield's precision?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33819