aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2013-09-11 12:20:07 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2013-09-11 12:20:07 +0000
commit5c2961cf38a69f2579718f369753c7939a7e5ad1 (patch)
treebe8cec824a00db79a4fe6fbc29e2397d2ce351a1 /gcc
parent427e6a142188fcfdc0efd4eed41ae717ee233e94 (diff)
downloadgcc-5c2961cf38a69f2579718f369753c7939a7e5ad1.zip
gcc-5c2961cf38a69f2579718f369753c7939a7e5ad1.tar.gz
gcc-5c2961cf38a69f2579718f369753c7939a7e5ad1.tar.bz2
re PR c++/58377 (spurious "may be used uninitialized" warning with -Og)
2013-09-11 Richard Biener <rguenther@suse.de> PR middle-end/58377 * passes.def: Split critical edges before late uninit warning passes. * tree-cfg.c (pass_split_crit_edges): Implement clone method. * g++.dg/uninit-pred-4.C: New testcase. From-SVN: r202496
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/passes.def6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/uninit-pred-4.C16
-rw-r--r--gcc/tree-cfg.c1
5 files changed, 34 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e5e1702..5e9b207 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2013-09-11 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58377
+ * passes.def: Split critical edges before late uninit warning passes.
+ * tree-cfg.c (pass_split_crit_edges): Implement clone method.
+
2013-09-11 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/58385
diff --git a/gcc/passes.def b/gcc/passes.def
index 736a28b..635b4c4 100644
--- a/gcc/passes.def
+++ b/gcc/passes.def
@@ -249,6 +249,9 @@ along with GCC; see the file COPYING3. If not see
account for the predicates protecting the set and the use of each
variable. Using a representation like Gated Single Assignment
may help. */
+ /* Split critical edges before late uninit warning to reduce the
+ number of false positives from it. */
+ NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_late_warn_uninitialized);
NEXT_PASS (pass_dse);
NEXT_PASS (pass_forwprop);
@@ -282,6 +285,9 @@ along with GCC; see the file COPYING3. If not see
/* ??? We do want some kind of loop invariant motion, but we possibly
need to adjust LIM to be more friendly towards preserving accurate
debug information here. */
+ /* Split critical edges before late uninit warning to reduce the
+ number of false positives from it. */
+ NEXT_PASS (pass_split_crit_edges);
NEXT_PASS (pass_late_warn_uninitialized);
NEXT_PASS (pass_uncprop);
NEXT_PASS (pass_local_pure_const);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c924967..49e28ad 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2013-09-11 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/58377
+ * g++.dg/uninit-pred-4.C: New testcase.
+
2013-09-11 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/58385
diff --git a/gcc/testsuite/g++.dg/uninit-pred-4.C b/gcc/testsuite/g++.dg/uninit-pred-4.C
new file mode 100644
index 0000000..94ab13c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/uninit-pred-4.C
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-Wuninitialized -Og" } */
+
+int pop ();
+int pop_first_bucket;
+
+int my_pop ()
+{
+ int out; // { dg-bogus "uninitialized" "uninitialized variable warning" }
+
+ while (pop_first_bucket)
+ if (pop_first_bucket && (out = pop()))
+ return out;
+
+ return 0;
+}
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index c74b988..dfe1001 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7929,6 +7929,7 @@ public:
/* opt_pass methods: */
unsigned int execute () { return split_critical_edges (); }
+ opt_pass * clone () { return new pass_split_crit_edges (ctxt_); }
}; // class pass_split_crit_edges
} // anon namespace