aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2023-01-03 12:13:24 +0100
committerJakub Jelinek <jakub@redhat.com>2023-01-03 12:13:24 +0100
commit226a498733e7919de72eb6f1bf3e16883ad159f6 (patch)
treef75fc245fc4ff0eadede1e5dd708e09f64be0f67 /gcc/expr.cc
parent4fb639a7fee5df32a2d1e7afa40fdf31d280464b (diff)
downloadgcc-226a498733e7919de72eb6f1bf3e16883ad159f6.zip
gcc-226a498733e7919de72eb6f1bf3e16883ad159f6.tar.gz
gcc-226a498733e7919de72eb6f1bf3e16883ad159f6.tar.bz2
expr: Fix up store_expr into SUBREG_PROMOTED_* target [PR108264]
The following testcase ICEs on s390x-linux (e.g. with -march=z13). The problem is that target is (subreg/s/u:SI (reg/v:DI 66 [ x+-4 ]) 4) and we call convert_move from temp to the SUBREG_REG of that, expecting to extend the value properly. That works nicely if temp has some scalar integer mode (or partial one), but ICEs when temp has V4QImode on the assertion that from and to modes have the same bitsize. store_expr generally allows say store from V4QI to SI target because they have the same size and if temp is a CONST_INT, we already have code to convert the constant properly, so the following patch just adds handling of non-scalar integer modes by converting them to the mode of target first before convert_move extends them. 2023-01-03 Jakub Jelinek <jakub@redhat.com> PR middle-end/108264 * expr.cc (store_expr): For stores into SUBREG_PROMOTED_* targets from source which doesn't have scalar integral mode first convert it to outer_mode. * gcc.dg/pr108264.c: New test.
Diffstat (limited to 'gcc/expr.cc')
-rw-r--r--gcc/expr.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/expr.cc b/gcc/expr.cc
index 372ad34..15be1c8 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -6226,6 +6226,9 @@ store_expr (tree exp, rtx target, int call_param_p,
temp = convert_modes (inner_mode, outer_mode, temp,
SUBREG_PROMOTED_SIGN (target));
}
+ else if (!SCALAR_INT_MODE_P (GET_MODE (temp)))
+ temp = convert_modes (outer_mode, TYPE_MODE (TREE_TYPE (exp)),
+ temp, SUBREG_PROMOTED_SIGN (target));
convert_move (SUBREG_REG (target), temp,
SUBREG_PROMOTED_SIGN (target));