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; }
Dup. *** This bug has been marked as a duplicate of bug 18501 ***