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: Constrain valid arguments to BIT_FIELD_REF


On 3/4/08 10:55 AM, Richard Guenther wrote:

I suggest to make sure that bit position and size are constants, the
object referenced is of integral type (BIT_FIELD_REF should not be
used as a way to circumvent aliasing) and the result type is of the
same type as the operand zero type (and not a bitfield type of the
referenced size -- in which case the BIT_FIELD_REF_UNSIGNED would
be useless).  The result would then be properly extended according
to BIT_FIELD_REF_UNSIGNED.

Is this how it was intended?

If it wasn't, I think the semantics you propose are fine. If this is only generated by the ME, it should be easy to change.



fold currently optimizes a.b.c == 0 to BIT_FIELD_REF <a, 8, big-num> & 1
for bit field field-decls c.  IMHO this is bad because it pessimizes
TBAA (needs to use a's alias set, not the underlying integral type
alias set) and it "breaks" type correctness as arbitrary structure
types appear as operand zero.

Agreed. Unless this was done to fix some target-specific problem, I think it should disappear.



Diego.



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