public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "Paulo.Matos at csr dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/53917] Warning message line about variable points to place where variable doesn't occur
Date: Tue, 10 Jul 2012 16:37:00 -0000	[thread overview]
Message-ID: <bug-53917-4-dYtxdnNZS2@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53917-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #1 from Paulo J. Matos <Paulo.Matos at csr dot com> 2012-07-10 16:37:20 UTC ---
Here's another example:
void fn1 ();
typedef struct
{
    int hdr[0];
} foo;
typedef enum
{
    READ_WRITE
} bar;
typedef struct
{
    struct
    {
        foo t1;
    } mp;
} foobar;
bar fn2 ();
typedef struct
{
    foobar tag_mem_config;
} tag;
static int
fn3 (foobar * p1)
{
    int valid;
    if (p1->mp.t1.hdr[0])
        valid = 0;
    else
        switch (fn2 ())
        case 0:
    valid = 1;
    return valid;
}
void
fn4 ()
{
    tag p_t1_rw_fsm_data;
    if (fn3 (&p_t1_rw_fsm_data.tag_mem_config))
        fn1 ();
}

GCC says:
test.c: In function 'fn4':
test.c:38:8: warning: 'valid' may be used uninitialized in this function
[-Wuninitialized]


Again, line 38 is: if (fn3 (&p_t1_rw_fsm_data.tag_mem_config))
In this case this looks like it's related to inlining.


  reply	other threads:[~2012-07-10 16:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10 16:13 [Bug middle-end/53917] New: " Paulo.Matos at csr dot com
2012-07-10 16:37 ` Paulo.Matos at csr dot com [this message]
2012-07-10 16:38 ` [Bug middle-end/53917] " Paulo.Matos at csr dot com
2021-03-25 22:40 ` [Bug middle-end/53917] Wuninitialized warning " msebor at gcc dot gnu.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=bug-53917-4-dYtxdnNZS2@http.gcc.gnu.org/bugzilla/ \
    --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).