]> gcc.gnu.org Git - gcc.git/commit
bitint: Fix up lowering of bitfield loads/stores [PR114313]
authorJakub Jelinek <jakub@redhat.com>
Wed, 13 Mar 2024 09:19:04 +0000 (10:19 +0100)
committerJakub Jelinek <jakub@redhat.com>
Wed, 13 Mar 2024 09:19:04 +0000 (10:19 +0100)
commit0613b12dd7f6274a1aac07f295ed51d86c2c85f1
treeee3fb3b9b2b42af34e51c8c3f8d0a0932fedc1d5
parentc5037fcee2de438774466e78e46e6ab4df72a7fe
bitint: Fix up lowering of bitfield loads/stores [PR114313]

The following testcase ICEs, because for large/huge _BitInt bitfield
loads/stores we use the DECL_BIT_FIELD_REPRESENTATIVE as the underlying
"var" and indexes into it can be larger than the precision of the
bitfield might normally allow.

The following patch fixes that by passing NULL_TREE type in that case
to limb_access, so that we always return m_limb_type type and don't
do the extra assertions, after all, the callers expect that too.
I had to add the first hunk to avoid ICE, it was using type in one place
even when it was NULL.  But TYPE_SIZE (TREE_TYPE (var)) seems like the
right size to use anyway because the code uses VIEW_CONVERT_EXPR on it.

2024-03-13  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/114313
* gimple-lower-bitint.cc (bitint_large_huge::limb_access): Use
TYPE_SIZE of TREE_TYPE (var) rather than TYPE_SIZE of type.
(bitint_large_huge::handle_load): Pass NULL_TREE rather than
rhs_type to limb_access for the bitfield load cases.
(bitint_large_huge::lower_mergeable_stmt): Pass NULL_TREE rather than
lhs_type to limb_access if nlhs is non-NULL.

* gcc.dg/torture/bitint-62.c: New test.
gcc/gimple-lower-bitint.cc
gcc/testsuite/gcc.dg/torture/bitint-62.c [new file with mode: 0644]
This page took 0.069298 seconds and 5 git commands to generate.