public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "christoph dot mallon at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/30856] [4.1/4.2/4.3 Regression] Missing "warning: '$FOO' may be used uninitialized in this function" in trivial case
Date: Mon, 19 Feb 2007 13:57:00 -0000	[thread overview]
Message-ID: <20070219135710.7628.qmail@sourceware.org> (raw)
In-Reply-To: <bug-30856-14120@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2007-02-19 13:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-19  9:24 [Bug c/30856] New: " christoph dot mallon at gmx dot de
2007-02-19 10:05 ` [Bug c/30856] [4.1/4.2/4.3 Regression] " rguenth at gcc dot gnu dot org
2007-02-19 10:09 ` rguenth at gcc dot gnu dot org
2007-02-19 10:12 ` [Bug middle-end/30856] " pinskia at gcc dot gnu dot org
2007-02-19 13:57 ` christoph dot mallon at gmx dot de [this message]
2007-02-19 14:07 ` muntyan at tamu dot edu
2007-02-19 14:26 ` christoph dot mallon at gmx dot de
2007-02-19 15:57 ` rguenth at gcc dot gnu dot org
2007-02-19 16:28 ` christoph dot mallon at gmx dot de
2007-02-19 18:44 ` pinskia at gcc dot gnu dot org
2007-02-20  6:02 ` christoph dot mallon at gmx dot de
2009-02-07 21:21 ` [Bug middle-end/30856] missing uninitialized variable warning (CCP) manu at gcc dot gnu dot org
2009-02-07 21:29 ` manu at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070219135710.7628.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).