diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-11 08:32:29 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-09-11 08:32:29 +0000 |
commit | 8edd00b27ca19ebc517e1937a41fc86c290f67a1 (patch) | |
tree | 98c427e048e3281aefa608f46fb037c66bd0f9e8 /gcc/gimple-fold.c | |
parent | cef94116307313211b4fa86d7779781713691b96 (diff) | |
download | gcc-8edd00b27ca19ebc517e1937a41fc86c290f67a1.tar.gz |
2012-09-11 Richard Guenther <rguenther@suse.de>
PR middle-end/54515
* gimple.c (get_base_address): Do not return NULL_TREE apart
from for WITH_SIZE_EXPR.
* gimple-fold.c (canonicalize_constructor_val): Do not call
get_base_address when not necessary.
* g++.dg/tree-ssa/pr54515.C: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@191174 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple-fold.c')
-rw-r--r-- | gcc/gimple-fold.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 42bc0fcb83a..bb13e1fd732 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -154,13 +154,15 @@ canonicalize_constructor_val (tree cval, tree from_decl) } if (TREE_CODE (cval) == ADDR_EXPR) { - tree base = get_base_address (TREE_OPERAND (cval, 0)); - if (!base && TREE_CODE (TREE_OPERAND (cval, 0)) == COMPOUND_LITERAL_EXPR) + tree base = NULL_TREE; + if (TREE_CODE (TREE_OPERAND (cval, 0)) == COMPOUND_LITERAL_EXPR) { base = COMPOUND_LITERAL_EXPR_DECL (TREE_OPERAND (cval, 0)); if (base) TREE_OPERAND (cval, 0) = base; } + else + base = get_base_address (TREE_OPERAND (cval, 0)); if (!base) return NULL_TREE; |