Constrain valid arguments to BIT_FIELD_REF
Diego Novillo
dnovillo@google.com
Tue Mar 4 16:15:00 GMT 2008
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.
More information about the Gcc
mailing list