This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Help with bit-field semantics in C and C++


On Tue, 24 Aug 2004, Geoff Keating wrote:
> It's interesting that you mention bitfields.  I believe that's a case
> where the mode's bitsize is not the same as the precision of the
> bitfield's type, but the bitfield must be sign- or zero- extended.

The problem is that these values are neither sign nor zero extended.
We currently can't rely on the bits beyond the type's precision but
below the type's mode's bitsize being copies of the sign-bit, indeed
we can't even guarantee that all such bits are the same.

There's a PR where fold optimizes "x & signbit" into "x < 0" which
unfortunately doesn't hold C++ enumerated types.  Indeed it isn't
clear whether signed vs. unsigned type distinction makes much sense
for these "paradoxical" types (terminology implied by RTL SUBREGs).

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]