This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] Unused variable warnings
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: law at redhat dot com
- Cc: Jan Hubicka <jh at suse dot cz>, Jan Hubicka <hubicka at ucw dot cz>,Richard Henderson <rth at redhat dot com>,Andrew MacLeod <amacleod at redhat dot com>,gcc mailing list <gcc at gcc dot gnu dot org>,Diego Novillo <dnovillo at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Sun, 19 Oct 2003 09:52:27 +0200
- Subject: Re: [tree-ssa] Unused variable warnings
- References: <20031017193025.GO6212@kam.mff.cuni.cz> <200310190419.h9J4JuFW020734@speedy.slc.redhat.com>
> In message <20031017193025.GO6212@kam.mff.cuni.cz>, Jan Hubicka writes:
> >OK,
> >I have one problem. It is a warning:
> >../../gcc/haifa-sched.c:2042: warning: 'index' might be used uninitialized in
> > this function
> >
> >index is initialized by:
> >if (max_issue (ready, &index) == 0)
> >
> >where max_issue is function that really has path throught that really
> >does not write into the index variable, so this warning is de-facto
> >right, just not obvious. What do we want to do here?
> If there's really a path were index is uninitialized, then clearly we
> want to initialize it to a safe value, both for the branch and the
> mainline.
Yes, however the path is created by inlining function max_issue and
optimizing out & and *. So whether we realize this condition or not
depend on how much inlining we do that is somewhat ugly.
The path never actually happens in reality (max_issue either finds value
and sets it or indicate failure), but we are not smart enought to thread
the jumps.
>
> >Shall I simply add initializer to this variable and another one in
> >f/lex.c as we do in usual case of this warning?
> If f/lex.c also has a real path where the variable is uninitialized, yes
> (and again, the same patch probably belongs on the mainline).
Similarly here.
Honza
>
> jeff