diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-16 19:54:23 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-01-16 19:54:23 +0000 |
commit | e8e60ada8c4537a0316142e7f701ad2615526e36 (patch) | |
tree | 4658ec6993cb1ef20e3a955c89af2533c00fed1c /gcc/expr.c | |
parent | e111028e66dcb159b0c139e3a3d2508f7c335ab7 (diff) | |
download | gcc-e8e60ada8c4537a0316142e7f701ad2615526e36.tar.gz |
PR middle-end/58344
* expr.c (expand_expr_real_1): Handle init == NULL_TREE.
* gcc.c-torture/compile/pr58344.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@206685 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c index 400a152ce56..878a51b2510 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -9832,7 +9832,25 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode, || TREE_CODE (array) == CONST_DECL) && (init = ctor_for_folding (array)) != error_mark_node) { - if (TREE_CODE (init) == CONSTRUCTOR) + if (init == NULL_TREE) + { + tree value = build_zero_cst (type); + if (TREE_CODE (value) == CONSTRUCTOR) + { + /* If VALUE is a CONSTRUCTOR, this optimization is only + useful if this doesn't store the CONSTRUCTOR into + memory. If it does, it is more efficient to just + load the data from the array directly. */ + rtx ret = expand_constructor (value, target, + modifier, true); + if (ret == NULL_RTX) + value = NULL_TREE; + } + + if (value) + return expand_expr (value, target, tmode, modifier); + } + else if (TREE_CODE (init) == CONSTRUCTOR) { unsigned HOST_WIDE_INT ix; tree field, value; |