aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2006-08-25 21:14:24 +0000
committerJoseph Myers <joseph@codesourcery.com>2006-08-25 21:14:24 +0000
commite72a3c3197205e1b590835f626e31527b0ee37cd (patch)
treec74edb98c64859323c9f5142edde85870356053a
parent1fc67759e0b2ae98b0881dd85318c853e00dc63b (diff)
2006-08-25 Fariborz Jahanian <fjahanian@apple.com>
PR c/28418 * c-gimplify.c (gimplify_compound_literal_expr): Don't add variable again if DECL_SEEN_IN_BIND_EXPR_P. 2006-08-25 Joseph S. Myers <joseph@codesourcery.com> * gcc.c-torture/compile/compound-literal-1.c: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@116436 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/c-gimplify.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c9
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 582ea4d8432..b56d2102577 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-25 Fariborz Jahanian <fjahanian@apple.com>
+
+ PR c/28418
+ * c-gimplify.c (gimplify_compound_literal_expr): Don't add
+ variable again if DECL_SEEN_IN_BIND_EXPR_P.
+
2006-08-25 Joseph S. Myers <joseph@codesourcery.com>
PR c/28299
diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c
index 60ef914159f..7ddc88cf4ea 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-gimplify.c
@@ -187,7 +187,7 @@ gimplify_compound_literal_expr (tree *expr_p, tree *pre_p)
/* This decl isn't mentioned in the enclosing block, so add it to the
list of temps. FIXME it seems a bit of a kludge to say that
anonymous artificial vars aren't pushed, but everything else is. */
- if (DECL_NAME (decl) == NULL_TREE)
+ if (DECL_NAME (decl) == NULL_TREE && !DECL_SEEN_IN_BIND_EXPR_P (decl))
gimple_add_tmp_var (decl);
gimplify_and_add (decl_s, pre_p);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 85df20fdf7f..9965dd5c338 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2006-08-25 Joseph S. Myers <joseph@codesourcery.com>
+ PR c/28418
+ * gcc.c-torture/compile/compound-literal-1.c: New test.
+
+2006-08-25 Joseph S. Myers <joseph@codesourcery.com>
+
PR c/28299
* gcc.dg/funcdef-var-1.c, gcc.dg/funcdef-var-2.c: New tests.
* gcc.dg/pr20368-1.c, gcc.dg/pr20368-2.c, gcc.dg/pr20368-3.c:
diff --git a/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c b/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c
new file mode 100644
index 00000000000..968bb450a71
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/compound-literal-1.c
@@ -0,0 +1,9 @@
+/* ICE incrementing compound literal: bug 28418 from Volker Reichelt
+ <reichelt@gcc.gnu.org>. */
+
+struct A { int i; };
+
+void foo()
+{
+ ((struct A) { 0 }).i += 1;
+}