------- Comment #4 from christoph dot mallon at gmx dot de  2007-02-19 13:57 
-------
(In reply to comment #1)
> This is because we don't warn for uninitialized PHIs in
> early_warn_uninitialized
> and later the code is removed because it is dead.

The code is certainly not dead.
The local variable 'y' is used as return value of the function.
I don't know how exactly the internal representation of GCC is, but it should
be something like:
t = phi(42, UNDEFINED)
ret t

I doubt this is a duplicate of Bug 22456 because the code there is dead.
It looks more like Bug 30542 and Bug 30575 which both are mentioned in Bug
22456. These do not look like duplicates of Bug 22456 either because the code
there is not dead.


Ok, I investigated a bit more on this:
int f(int x)
{
  int y;
  if (x == 42) y = 23;
  else if (x == 23) y = 42;
  return y;
}

This function triggers the expected warning message.
This is because the Phi in this case has three inputs.
In the other example (or if you remove the else in the code above) you have a
Phi with two inputs. One of these is undefined and phase 033t.ccp optimises
this Phi away (which per se is ok, the value is undefined after all) and only
its one defined input remains. If the Phi has more (different) inputs this
optimisation cannot happen.
The problem is the warning about possibly undefined values definitely should be
generated _before_ this phase.
I think it is a major bug if this warning simply vanishes in some cases.


-- 

christoph dot mallon at gmx dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |


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

Reply via email to