This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Constrain valid arguments to BIT_FIELD_REF
- From: "Andrew Pinski" <pinskia at gmail dot com>
- To: "Richard Guenther" <rguenther at suse dot de>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 4 Mar 2008 08:58:45 -0800
- Subject: Re: Constrain valid arguments to BIT_FIELD_REF
- References: <Pine.LNX.4.64.0803041650000.4133@zhemvz.fhfr.qr>
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