This is the mail archive of the gcc-patches@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: [tree-ssa] More CCP fixes [patch]


Mark Mitchell wrote:-

> >1) its true type (3 bit unsigned int) in the current type field
> 
> That is only its true type when used as an lvalue.

It's true in C99 to the best of my knowledge.  C++ could well be
different.  Is that what you're referring to?  If so, hmm, things
could be even more complicated.

> When used as an
> rvalue, its true type is whatever it was declared to be (int, unsigned
> int, etc. -- modulo the fact that "int" can mean "unsigned int"
> in a bitfield.)
> 
> A reference to a bit-field in an rvalue context should be treated as
> implicitly containing the right sign extensions.  That means that the
> tree node used to convert from (say) "unsigned int" to "signed int"
> should not be a NOP_EXPR -- you're not supposed to have generate code
> for a NOP_EXPR.

C99 says a bitfield is interpreted as a signed or unsigned type of the
specified number of bits.  So this doesn't work for C, right?  Or do
GCC trees expect a 3-bit value stored in them to have been
sign-extended?

Neil.


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