summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-07 08:28:01 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-07 08:28:01 +0000
commit03404fe6f86b46fd9b14ee9f6a050051b889b217 (patch)
tree4eccbeedfec96113534f93b0dbaed919ec83c5f3 /gcc
parent080ec2e380fb58bb76a9441199538f99f59f54ff (diff)
downloadgcc-03404fe6f86b46fd9b14ee9f6a050051b889b217.tar.gz
PR debug/57184
* expr.c (expand_expr_addr_expr_1): Handle COMPOUND_LITERAL_EXPR for modifier == EXPAND_INITIALIZER. * gcc.dg/pr57184.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198666 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/expr.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr57184.c13
4 files changed, 33 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2388ac8df9a..853ca0aa77e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-05-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/57184
+ * expr.c (expand_expr_addr_expr_1): Handle COMPOUND_LITERAL_EXPR
+ for modifier == EXPAND_INITIALIZER.
+
2013-05-07 Anton Blanchard <anton@samba.org>
* configure.ac (HAVE_LD_LARGE_TOC): Use correct linker emulation
diff --git a/gcc/expr.c b/gcc/expr.c
index acf282e7808..5663408b37b 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7561,6 +7561,15 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
inner = TREE_OPERAND (exp, 0);
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))
+ return expand_expr_addr_expr_1 (COMPOUND_LITERAL_EXPR_DECL (exp),
+ target, tmode, modifier, as);
+ /* FALLTHRU */
default:
/* If the object is a DECL, then expand it for its rtl. Don't bypass
expand_expr, as that can have various side effects; LABEL_DECLs for
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0908c8678e9..dee99f81e9f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-07 Jakub Jelinek <jakub@redhat.com>
+
+ PR debug/57184
+ * gcc.dg/pr57184.c: New test.
+
2013-05-07 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/specs/array3.ads: New test.
diff --git a/gcc/testsuite/gcc.dg/pr57184.c b/gcc/testsuite/gcc.dg/pr57184.c
new file mode 100644
index 00000000000..319d3fd5312
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr57184.c
@@ -0,0 +1,13 @@
+/* PR debug/57184 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+struct S {};
+void bar (struct S *const);
+static struct S *const c = &(struct S) {};
+
+void
+foo (void)
+{
+ bar (c);
+}