------- Comment #5 from manu at gcc dot gnu dot org  2007-08-22 17:14 -------
(In reply to comment #4)
> Just an interesting tidbit.
> 
> This testcase exposes a much more difficult/interesting long term problem. 
> Namely, how should we handle uninitialized warnings for variables which are
> exposed by optimization.

I think the problem reduces to "what we do when we are unsure?" Currently we
mostly warn except for CCP merging undefined values with constants and when the
address of the variable is passed to a function. If the body is not taken into
account (because it is not inlined) we assume that baz() initializes i. When
inlined, we are not sure anymore, so we warn. This will happen whenever more
optimisation turns the balance from "unsure but not warn" to "unsure but warn".
In the general case, I don't think this can be solved unless we always warn or
we always don't warn when unsure.

Therefore, the only thing we could do is handle the inlined version as well as
Andrew's testcase in comment #2.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


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

Reply via email to