This is the mail archive of the 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]

Constrain valid arguments to BIT_FIELD_REF

BIT_FIELD_REF is currently only generated by the middle-end (fold, SRA
and parts of the vectorizer).  At the moment the bit position and size
of the extract can be non-constant and the type of the result is

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

Is this how it was intended?

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.



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