public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/46045] incorrect code generated if redecalring local variable in do-while(0)
Date: Sat, 16 Oct 2010 13:32:00 -0000	[thread overview]
Message-ID: <20101016133200.i1X78QKtSRs9wNZ42HyINlvZd_t35rZ2yy8y6E4Wg1o@z> (raw)
In-Reply-To: <bug-46045-4@http.gcc.gnu.org/bugzilla/>

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

Zdenek Sojka <zsojka at seznam dot cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zsojka at seznam dot cz

--- Comment #1 from Zdenek Sojka <zsojka at seznam dot cz> 2010-10-16 13:31:58 UTC ---
> struct A *a = a;

Refers to the just declared variable, thus the variable is initialised by
itself.

$ gcc-4.6.0-pre9999 test.c -Wall -W -Wshadow -Winit-self
test.c: In function 'foo':
test.c:9:27: warning: declaration of 'a' shadows a parameter [-Wshadow]
test.c:6:27: warning: shadowed declaration is here [-Wshadow]
test.c:6:27: warning: unused parameter 'a' [-Wunused-parameter]
test.c: In function 'main':
test.c:14:14: warning: unused parameter 'argc' [-Wunused-parameter]
test.c:14:26: warning: unused parameter 'argv' [-Wunused-parameter]
test.c: In function 'foo':
test.c:9:27: warning: 'a' is used uninitialized in this function
[-Wuninitialized]

You get the warning with -Winit-self -Wuninitialized


  reply	other threads:[~2010-10-16 13:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-16 13:26 [Bug c/46045] New: " mbuilov at gmail dot com
2010-10-16 13:32 ` zsojka at seznam dot cz [this message]
2010-10-16 18:44 ` [Bug c/46045] " rguenth at gcc dot gnu.org
2010-10-17 15:51 ` mbuilov at gmail dot com
2010-10-17 16:19 ` mbuilov at gmail dot com

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=20101016133200.i1X78QKtSRs9wNZ42HyINlvZd_t35rZ2yy8y6E4Wg1o@z \
    --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).