aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-01-05 12:14:12 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2019-01-05 12:14:12 +0100
commit23141e52419417d34eab8a2976fe417a6041e15e (patch)
tree21f0ab12fe14cd100df4f2cdc94277ffc8c9cb28 /gcc/expr.c
parent4a3e7df872be0bb7198fed02746ff5e96ff1d584 (diff)
downloadgcc-23141e52419417d34eab8a2976fe417a6041e15e.zip
gcc-23141e52419417d34eab8a2976fe417a6041e15e.tar.gz
gcc-23141e52419417d34eab8a2976fe417a6041e15e.tar.bz2
re PR middle-end/82564 (ICE at -O1 and above: in assign_stack_temp_for_type, at function.c:783)
PR middle-end/82564 PR target/88620 * expr.c (expand_assignment): For calls returning VLA structures if to_rtx is not a MEM, force it into a stack temporary. * gcc.dg/nested-func-12.c: New test. * gcc.c-torture/compile/pr82564.c: New test. From-SVN: r267595
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 450486e..818ee2d 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5254,6 +5254,21 @@ expand_assignment (tree to, tree from, bool nontemporal)
emit_move_insn (XEXP (to_rtx, 1), read_complex_part (temp, true));
}
}
+ /* For calls to functions returning variable length structures, if TO_RTX
+ is not a MEM, go through a MEM because we must not create temporaries
+ of the VLA type. */
+ else if (!MEM_P (to_rtx)
+ && TREE_CODE (from) == CALL_EXPR
+ && COMPLETE_TYPE_P (TREE_TYPE (from))
+ && TREE_CODE (TYPE_SIZE (TREE_TYPE (from))) != INTEGER_CST)
+ {
+ rtx temp = assign_stack_temp (GET_MODE (to_rtx),
+ GET_MODE_SIZE (GET_MODE (to_rtx)));
+ result = store_field (temp, bitsize, bitpos, bitregion_start,
+ bitregion_end, mode1, from, get_alias_set (to),
+ nontemporal, reversep);
+ emit_move_insn (to_rtx, temp);
+ }
else
{
if (MEM_P (to_rtx))