PR debug/57184
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 May 2013 08:28:01 +0000 (08:28 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 7 May 2013 08:28:01 +0000 (08:28 +0000)
* 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

gcc/ChangeLog
gcc/expr.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr57184.c [new file with mode: 0644]

index 2388ac8..853ca0a 100644 (file)
@@ -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
index acf282e..5663408 100644 (file)
@@ -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
index 0908c86..dee99f8 100644 (file)
@@ -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 (file)
index 0000000..319d3fd
--- /dev/null
@@ -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);
+}