summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/pr37337.C37
-rw-r--r--gcc/tree-ssa-dom.c10
4 files changed, 57 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e8d4c0303f8..493ecad381f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2008-09-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/37337
+ * tree-ssa-dom.c (optimize_stmt): Call maybe_clean_or_replace_eh_stmt
+ even when a stmt has been gimple_modified_p, but after fold_stmt is
+ not any longer. Remove unneeded may_have_exposed_new_symbols
+ initializations.
+
2008-09-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37421
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e136c69091e..dc1901501a9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/37337
+ * g++.dg/tree-ssa/pr37337.C: New test.
+
2008-09-08 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37421
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr37337.C b/gcc/testsuite/g++.dg/tree-ssa/pr37337.C
new file mode 100644
index 00000000000..5b8521df8db
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/pr37337.C
@@ -0,0 +1,37 @@
+// PR middle-end/37337
+// { dg-do compile }
+// { dg-options "-O2" }
+
+extern "C"
+{
+ typedef struct _IO_FILE FILE;
+ extern int __fprintf_chk (FILE *, int, const char *, ...);
+ extern inline __attribute__ ((always_inline, gnu_inline, artificial))
+ int fprintf (FILE *s, const char *f, ...)
+ {
+ return __fprintf_chk (s, 1, f, __builtin_va_arg_pack ());
+ }
+}
+
+extern int a;
+struct A
+{
+ virtual ~A (void)
+ {
+ }
+};
+
+struct B : public A
+{
+ B ();
+ FILE *b;
+};
+
+void f (int *);
+B::B ()
+{
+ f (&a);
+ for (int i = 0; i < 6; i++)
+ fprintf (b, "%02x", 0xff);
+ fprintf (b, "\n--\n");
+}
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index cd7defa869c..bf2049eb8d8 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -2179,7 +2179,8 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
{
gimple stmt, old_stmt;
bool may_optimize_p;
- bool may_have_exposed_new_symbols = false;
+ bool may_have_exposed_new_symbols;
+ bool modified_p = false;
old_stmt = stmt = gsi_stmt (si);
@@ -2188,7 +2189,6 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
update_stmt_if_modified (stmt);
opt_stats.num_stmts++;
- may_have_exposed_new_symbols = false;
push_stmt_changes (gsi_stmt_ptr (&si));
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2237,6 +2237,10 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
Indicate we will need to rescan and rewrite the statement. */
may_have_exposed_new_symbols = true;
+ /* Indicate that maybe_clean_or_replace_eh_stmt needs to be called,
+ even if fold_stmt updated the stmt already and thus cleared
+ gimple_modified_p flag on it. */
+ modified_p = true;
}
/* Check for redundant computations. Do this optimization only
@@ -2285,7 +2289,7 @@ optimize_stmt (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
Ultimately I suspect we're going to need to change the interface
into the SSA_NAME manager. */
- if (gimple_modified_p (stmt))
+ if (gimple_modified_p (stmt) || modified_p)
{
tree val = NULL;