This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -Wuninitialized issues


On Sun, 2005-10-30 at 23:40 -0800, Mark Mitchell wrote:
> In reviewing the PR list, I saw several (maybe 5?) PRs about problems
> with -Wuninitialized.
[ ... ]
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.

The late pass could then also warn for those variables which were
marked by the first pass as maybe uninitialized, but which were
not marked by the second pass as maybe uninitialized -- these
are precisely those were optimizations either eliminated problem
paths through the CFG or DCE eliminated the uninitialized uses.

Thoughts?


jeff



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]