From: Jakub Jelinek Date: Thu, 27 Nov 2014 11:04:16 +0000 (+0100) Subject: re PR middle-end/64067 (ICE in expand_expr_real_1, at expr.c:10540, involving compoun... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=30d5d8c5189064c8ae30a4af232642077105ed80;p=gcc.git 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) : 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0d544fcb6d9..aa3aa237957 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2014-11-27 Jakub Jelinek + PR middle-end/64067 + * expr.c (expand_expr_addr_expr_1) : + 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. + PR tree-optimization/64024 * tree-vectorizer.h (struct _stmt_vec_info): Remove simd_clone_fndecl field. Add simd_clone_info field. 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 */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 045d4fde9a6..1bdaf1b9ef8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2014-11-27 Jakub Jelinek + PR middle-end/64067 + * gcc.c-torture/compile/pr64067.c: New test. + PR tree-optimization/64024 * gcc.dg/vect/vect-simd-clone-13.c: New test. * gcc.dg/vect/vect-simd-clone-14.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr64067.c b/gcc/testsuite/gcc.c-torture/compile/pr64067.c new file mode 100644 index 00000000000..24ad996efdb --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr64067.c @@ -0,0 +1,10 @@ +/* PR middle-end/64067 */ + +struct S { int s; }; +int *const v[1] = { &((struct S) { .s = 42 }).s }; + +int * +foo (void) +{ + return v[0]; +}