From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31426 invoked by alias); 16 Oct 2010 13:32:10 -0000 Received: (qmail 31415 invoked by uid 22791); 16 Oct 2010 13:32:09 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,MISSING_MID X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Oct 2010 13:32:05 +0000 From: "zsojka at seznam dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/46045] incorrect code generated if redecalring local variable in do-while(0) X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zsojka at seznam dot cz X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Sat, 16 Oct 2010 13:32:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-10/txt/msg01339.txt.bz2 Message-ID: <20101016133200.i1X78QKtSRs9wNZ42HyINlvZd_t35rZ2yy8y6E4Wg1o@z> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46045 Zdenek Sojka changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |zsojka at seznam dot cz --- Comment #1 from Zdenek Sojka 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