On February 26, 2014 8:58:11 PM GMT+01:00, Marek Polacek <pola...@redhat.com> wrote: >This fixes an oversight where we didn't run >execute_late_warn_uninitialized >when only -Wmaybe-uninitialize was specified -- gate_warn_uninitialized >should take warn_maybe_uninitialized into account. > >Regtested/bootstrapped on x86_64-linux, ok for trunk?
Ok. Thanks, Richard. >2014-02-26 Marek Polacek <pola...@redhat.com> > > PR middle-end/59223 > * tree-ssa-uninit.c (gate_warn_uninitialized): Run the pass even for > -Wmaybe-uninitialized. >testsuite/ > * c-c++-common/pr59223.c: New test. > >diff --git gcc/testsuite/c-c++-common/pr59223.c >gcc/testsuite/c-c++-common/pr59223.c >index e69de29..471c062 100644 >--- gcc/testsuite/c-c++-common/pr59223.c >+++ gcc/testsuite/c-c++-common/pr59223.c >@@ -0,0 +1,13 @@ >+/* PR c/59223 */ >+/* { dg-do compile } */ >+/* { dg-options "-O2 -Wmaybe-uninitialized" } */ >+ >+int foo (int x) >+{ >+ int y; >+ if (x == 0) >+ y = 1; >+ else if (x == 1) >+ y = 2; >+ return y; /* { dg-warning "may be used uninitialized in this >function" } */ >+} >diff --git gcc/tree-ssa-uninit.c gcc/tree-ssa-uninit.c >index d9b33b1..eee83f7 100644 >--- gcc/tree-ssa-uninit.c >+++ gcc/tree-ssa-uninit.c >@@ -2355,7 +2355,7 @@ execute_late_warn_uninitialized (void) > static bool > gate_warn_uninitialized (void) > { >- return warn_uninitialized != 0; >+ return warn_uninitialized || warn_maybe_uninitialized; > } > > namespace { > > Marek