This is the mail archive of the gcc@gcc.gnu.org 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]

Re: Constrain valid arguments to BIT_FIELD_REF


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


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