aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/gimplify.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr38104.C19
4 files changed, 34 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 32b67e5..c54e678 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2008-11-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/38104
+ * gimplify.c (gimple_regimplify_operands): Add referenced vars
+ before calling mark_symbols_for_renaming, not after it.
+
2008-11-14 Kaz Kojima <kkojima@gcc.gnu.org>
* config/sh/sh.h (OPTIMIZATION_OPTIONS): Revert last change.
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index ecc340a..c2de8fd 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -7566,6 +7566,10 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
break;
}
+ if (gimple_referenced_vars (cfun))
+ for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t))
+ add_referenced_var (t);
+
if (!gimple_seq_empty_p (pre))
{
if (gimple_in_ssa_p (cfun))
@@ -7580,10 +7584,6 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p)
if (post_stmt)
gsi_insert_after (gsi_p, post_stmt, GSI_NEW_STMT);
- if (gimple_referenced_vars (cfun))
- for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t))
- add_referenced_var (t);
-
pop_gimplify_context (NULL);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 15e8ea4..fcb3022 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-11-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/38104
+ * g++.dg/tree-ssa/pr38104.C: New test.
+
2008-11-14 Kaz Kojima <kkojima@gcc.gnu.org>
* gcc.target/sh/pr37514.c: Remove.
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr38104.C b/gcc/testsuite/g++.dg/tree-ssa/pr38104.C
new file mode 100644
index 0000000..6523a5e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr38104.C
@@ -0,0 +1,19 @@
+// PR tree-optimization/38104
+// { dg-do compile }
+// { dg-options "-O3" }
+
+struct S { int foo; };
+
+void f0 ();
+
+void
+f1 (struct S s)
+{
+ f0 ();
+}
+
+void
+f2 ()
+{
+ f1 (*(struct S *) (0));
+}