This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36296] wrong warning about potential uninitialized variable
- From: "vincent at vinc17 dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 May 2008 08:34:03 -0000
- Subject: [Bug middle-end/36296] wrong warning about potential uninitialized variable
- References: <bug-36296-16207@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from vincent at vinc17 dot org 2008-05-22 08:34 -------
The severity should probably be changed to enhancement because gcc behaves as
documented (well, almost).
What can be done IMHO is:
1. Split the -Wuninitialized into two different warnings: one for which gcc
knows that the variable is uninitialized and one for which it cannot decide.
-Wuninitialized currently does both.
2. Provide an extension so that the user can tell gcc not to emit a warning for
some particular variable. This would sometimes be better than adding a dummy
initialization (which has its own drawbacks).
In the mean time, make the documentation better concerning -Wuninitialized:
change the first sentence "Warn if an automatic variable is used without first
being initialized [...]" to "Warn if an automatic variable *may be* used
without first being initialized" (though the behavior is detailed later).
--
vincent at vinc17 dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vincent at vinc17 dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36296