From: Marek Polacek Date: Thu, 27 Feb 2014 08:05:21 +0000 (+0000) Subject: re PR middle-end/59223 (-Wmaybe-uninitialized and -Wuninitialized relationships) X-Git-Tag: releases/gcc-4.9.0~645 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb0d8e848833373f8e6e8ecb44377015b27a1f21;p=thirdparty%2Fgcc.git re PR middle-end/59223 (-Wmaybe-uninitialized and -Wuninitialized relationships) 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. From-SVN: r208196 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fd951a7ee3f2..b62103c31cc6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-02-27 Marek Polacek + + PR middle-end/59223 + * tree-ssa-uninit.c (gate_warn_uninitialized): Run the pass even for + -Wmaybe-uninitialized. + 2014-02-27 Alan Modra PR target/57936 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 48e2a1791fe8..128a5f7f8d7d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-02-27 Marek Polacek + + PR middle-end/59223 + * c-c++-common/pr59223.c: New test. + 2014-02-26 Ilya Tocar * common/config/i386/predicates.md (const1256_operand): Remove. diff --git a/gcc/testsuite/c-c++-common/pr59223.c b/gcc/testsuite/c-c++-common/pr59223.c new file mode 100644 index 000000000000..471c0625df33 --- /dev/null +++ b/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 a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c index d9b33b13e9b8..eee83f79a9ac 100644 --- a/gcc/tree-ssa-uninit.c +++ b/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 {