This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -Wuninitialized issues
- From: Neil Booth <neil at akihabara dot co dot uk>
- To: Jeffrey A Law <law at redhat dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>, gcc at gcc dot gnu dot org
- Date: Tue, 1 Nov 2005 20:49:56 +0900
- Subject: Re: -Wuninitialized issues
- References: <4365CA5E.3070401@codesourcery.com> <1130802583.19967.122.camel@localhost.localdomain>
Jeffrey A Law wrote:-
> After pondering this some more I almost wonder if what we need is a
> separate warning for variables which were potentially uninitialized
> but which optimization passes somehow proved were unused or the paths
> in which the variable was uninitialized were unexecutable.
>
> So the early pass would catch unconditionally uninitialized variables;
> it would also record (but not warn for) maybe uninitialized variables
> (by detecting default definitions appearing in PHI nodes).
>
> The late pass would then issue a may-be-uninitialized warning for
> any variables which still had a default definition appearing in a
> PHI node.
I think this is a better approach than the current one, and that
if we go down this patch then we should grasp the opportunity to
do it right - the early pass should be in the front end. Let the
optimizers do the fancy cases. 90% of cases that catch bugs can
be handled in the front end I expect, with a very simple algorithm.
Neil.