diff options
author | Jakub Jelinek <jakub@redhat.com> | 2024-10-31 10:52:56 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2024-10-31 10:52:56 +0100 |
commit | b39f62ff739e9ffea0e6485667f15b985f8cd63d (patch) | |
tree | 2aefabea5d3adce9b481e8a08abe61d96f2068b2 /gcc/expr.cc | |
parent | 1f7b1c555c66cf55f9032ea14135f29d27d34811 (diff) | |
download | gcc-b39f62ff739e9ffea0e6485667f15b985f8cd63d.zip gcc-b39f62ff739e9ffea0e6485667f15b985f8cd63d.tar.gz gcc-b39f62ff739e9ffea0e6485667f15b985f8cd63d.tar.bz2 |
expand: Fix up expansion of VIEW_CONVERT_EXPR to BITINT_TYPE [PR117354]
The following testcase ICEs, because when trying to expand the
VIEW_CONVERT_EXPR operand which is SSA_NAME defined to
V32QI or V4DI MEM_REF which is aligned just to 8 bytes we force
it as unaligned into a register, but then try to call extract_bit_field
from the V32QI or V4DI register to BLKmode. extract_bit_field doesn't
obviously support BLKmode extraction and so ICEs.
The second hunk fixes the ICE by not calling extract_bit_field when
it can't handle it, the last if will handle it properly by storing
it to memory and using BLKmode access to the copy.
The first hunk is an optimization, if mode is BLKmode, by setting
inner_reference_p argument to expand_expr_real we avoid the
expand_misaligned_mem_ref calls which load it from memory into a register.
2024-10-31 Jakub Jelinek <jakub@redhat.com>
PR middle-end/117354
* expr.cc (expand_expr_real_1) <case VIEW_CONVERT_EXPR>: Pass
true as inner_reference_p argument to expand_expr_real if
mode is BLKmode. Don't call extract_bit_field if mode is BLKmode.
* gcc.dg/bitint-113.c: New test.
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r-- | gcc/expr.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc index 348ac3c..caa1a72 100644 --- a/gcc/expr.cc +++ b/gcc/expr.cc @@ -12468,7 +12468,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, if (!op0) op0 = expand_expr_real (treeop0, NULL_RTX, VOIDmode, modifier, - NULL, inner_reference_p); + NULL, inner_reference_p || mode == BLKmode); /* If the input and output modes are both the same, we are done. */ if (mode == GET_MODE (op0)) @@ -12505,7 +12505,7 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode, op0 = convert_modes (mode, GET_MODE (op0), op0, TYPE_UNSIGNED (TREE_TYPE (treeop0))); /* If the output type is a bit-field type, do an extraction. */ - else if (reduce_bit_field) + else if (reduce_bit_field && mode != BLKmode) return extract_bit_field (op0, TYPE_PRECISION (type), 0, TYPE_UNSIGNED (type), NULL_RTX, mode, mode, false, NULL); |