https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105534
Bug ID: 105534 Summary: -Wmaybe-uninitialized shouldn't suppress -Wuninitialized warnings Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redbeard0531 at gmail dot com Target Milestone: --- The following function emits a -Wuninitialized warning on ++count with -Wall https://godbolt.org/z/KfaMEETY1: int test(bool cond) { int count; ++count; return count; } Making the increment be conditional changes it to a -Wmaybe-uninitialized warning, which is suppressed with -Wno-maybe-uninitialized. https://godbolt.org/z/qarMrqW7E int test(bool cond) { int count; if (cond) ++count; return count; } This makes no sense. count is never initialized on any path through the function, and it is returned on all paths. We use -Wall with -Wno-maybe-uninitialized on our codebase because we were getting too many false-positives with -Wmaybe-initialized, in particular from third-party headers that we didn't want to modify. At the time we decided to do that, we didn't realize that we would also be missing out on clearly uninitialized cases like this.