summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-27 11:04:16 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2014-11-27 11:04:16 +0000
commit50f9371e4024bd79fa05e517dbffc27b9e78bccc (patch)
treeba75a22c11ee8ec8565979f197bbccd16dce63b5 /gcc/expr.c
parent295327abc85c433f5efd2b4b1c6d4407d0810c4e (diff)
downloadgcc-50f9371e4024bd79fa05e517dbffc27b9e78bccc.tar.gz
PR middle-end/64067
* expr.c (expand_expr_addr_expr_1) <case COMPOUND_LITERAL_EXPR>: Handle it by returning address of COMPOUND_LITERAL_EXPR_DECL not only if modifier is EXPAND_INITIALIZER, but whenever COMPOUND_LITERAL_EXPR_DECL is non-NULL and TREE_STATIC. * gcc.c-torture/compile/pr64067.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218121 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index c7621b0e9c8..3d2ff6ec03a 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7677,11 +7677,13 @@ expand_expr_addr_expr_1 (tree exp, rtx target, machine_mode tmode,
break;
case COMPOUND_LITERAL_EXPR:
- /* Allow COMPOUND_LITERAL_EXPR in initializers, if e.g.
- rtl_for_decl_init is called on DECL_INITIAL with
- COMPOUNT_LITERAL_EXPRs in it, they aren't gimplified. */
- if (modifier == EXPAND_INITIALIZER
- && COMPOUND_LITERAL_EXPR_DECL (exp))
+ /* Allow COMPOUND_LITERAL_EXPR in initializers or coming from
+ initializers, if e.g. rtl_for_decl_init is called on DECL_INITIAL
+ with COMPOUND_LITERAL_EXPRs in it, or ARRAY_REF on a const static
+ array with address of COMPOUND_LITERAL_EXPR in DECL_INITIAL;
+ the initializers aren't gimplified. */
+ if (COMPOUND_LITERAL_EXPR_DECL (exp)
+ && TREE_STATIC (COMPOUND_LITERAL_EXPR_DECL (exp)))
return expand_expr_addr_expr_1 (COMPOUND_LITERAL_EXPR_DECL (exp),
target, tmode, modifier, as);
/* FALLTHRU */