https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88968

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem is that for these packed structs the DECL_BIT_FIELD_REPRESENTATIVE
is not integral FIELD_DECL that the c-omp.c code assumes.  BIT_FIELD_REF seems
to work with non-integral base types from which the field is extracted:
/* Reference to a group of bits within an object.  Similar to COMPONENT_REF
   except the position is given explicitly rather than via a FIELD_DECL.
   Operand 0 is the structure or union expression;
   operand 1 is a tree giving the constant number of bits being referenced;
   operand 2 is a tree giving the constant position of the first referenced
bit.
   The result type width has to match the number of bits referenced.
   If the result type is integral, its signedness specifies how it is extended
   to its mode width.  */
DEFTREECODE (BIT_FIELD_REF, "bit_field_ref", tcc_reference, 3)
but we need to insert the field back and for that the BIT_INSERT_EXPR we are
using requires that it stores into an integral or vector type expression:
/* Given a container value, a replacement value and a bit position within
   the container, produce the value that results from replacing the part of
   the container starting at the bit position with the replacement value.
   Operand 0 is a tree for the container value of integral or vector type;
   Operand 1 is a tree for the replacement value of another integral or
   the vector element type;
   Operand 2 is a tree giving the constant bit position;
   The number of bits replaced is given by the precision of the type of the
   replacement value if it is integral or by its size if it is non-integral.
   ???  The reason to make the size of the replacement implicit is to avoid
   introducing a quaternary operation.
   The replaced bits shall be fully inside the container.  If the container
   is of vector type, then these bits shall be aligned with its elements.  */
DEFTREECODE (BIT_INSERT_EXPR, "bit_insert_expr", tcc_expression, 3)

Reply via email to