Skip to content
Snippets Groups Projects
Commit 0613b12d authored by Jakub Jelinek's avatar Jakub Jelinek
Browse files

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.
parent c5037fce
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment