Constrain valid arguments to BIT_FIELD_REF
Andrew Pinski
pinskia@gmail.com
Tue Mar 4 16:59:00 GMT 2008
On 3/4/08, Richard Guenther <rguenther@suse.de> 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.
I tried non constant bit position with BIT_FIELD_REF of vector types
and it crashed in expand so I think this is the correct thing to do.
Though it would be nice if we have a VEC_EXTRACT tree instead of
overloading BIT_FIELD_REF for it that takes a non constant position so
we can do better optimization there in some cases (yes people write
code that extracts parts of vectors, trust me).
-- Pinski
More information about the Gcc
mailing list