https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81049
Bug ID: 81049 Summary: no warning for simple uninitialized variables Product: gcc Version: 7.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: luc.vanoostenryck at gmail dot com Target Milestone: --- gcc doesn't issue a warning for very simple cases of uninitialized variable. The options used are '-Wuninitialized -O2' or '-Wmaybe-uninitialized -O2'. It can be reproduced with gcc 5.4, 6.3 and gcc 7.1 (I didn't tried older versions). One example of code to show this is: int g; int foo(void) { int r = 0; int u; if (g) r = u; return r; }