[Bug middle-end/55873] Missed trivial uninitialized use warning

manu at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Jan 5 12:16:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55873

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-01-05 12:15:35 UTC ---
PR18501, the most frequently reported Wuninitialized bug.

Of course, it is possible to fix it. Clang does warn:

pr18501.c:5:7: warning: variable 'res' is used uninitialized whenever 'if'
condition is false [-Wsometimes-uninitialized]
  if (c)
      ^
pr18501.c:7:10: note: uninitialized use occurs here
  return res;
         ^~~
pr18501.c:5:3: note: remove the 'if' if its condition is always true
  if (c)
  ^~~~~~
pr18501.c:4:10: note: initialize the variable 'res' to silence this warning
  int res;
         ^
          = 0
1 warning generated.

It is just that it probably needs some serious amount of work.



More information about the Gcc-bugs mailing list