This is the mail archive of the
mailing list for the GCC project.
Constrain valid arguments to BIT_FIELD_REF
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 4 Mar 2008 16:55:50 +0100 (CET)
- Subject: 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.