aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2014-11-27 12:04:16 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2014-11-27 12:04:16 +0100
commit30d5d8c5189064c8ae30a4af232642077105ed80 (patch)
treeba75a22c11ee8ec8565979f197bbccd16dce63b5 /gcc/expr.c
parent6c9e85fb8b2fffbdac9c3170c98497d6d1bdc26b (diff)
downloadgcc-30d5d8c5189064c8ae30a4af232642077105ed80.zip
gcc-30d5d8c5189064c8ae30a4af232642077105ed80.tar.gz
gcc-30d5d8c5189064c8ae30a4af232642077105ed80.tar.bz2
re PR middle-end/64067 (ICE in expand_expr_real_1, at expr.c:10540, involving compound literal shenanigans)
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. From-SVN: r218121
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 c7621b0..3d2ff6e 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 */