From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3383 invoked by alias); 18 Sep 2011 14:38:26 -0000 Received: (qmail 3338 invoked by uid 22791); 18 Sep 2011 14:38:25 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.160) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Sep 2011 14:38:02 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGOZE+TiTS5oCO0h4pIng== X-RZG-CLASS-ID: mo00 Received: from [192.168.2.100] (dslb-084-058-209-047.pools.arcor-ip.net [84.58.209.47]) by post.strato.de (mrclete mo14) (RZmta 26.7) with ESMTPA id d0207dn8IE8mdb ; Sun, 18 Sep 2011 16:37:55 +0200 (MEST) Message-ID: <4E760228.7000107@gjlay.de> Date: Sun, 18 Sep 2011 14:38:00 -0000 From: Georg-Johann Lay User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) MIME-Version: 1.0 To: Jonathan Wakely CC: gcc-help@gcc.gnu.org Subject: Re: Missing "var is used uninitialized" warning? References: <4E7503F3.5060800@gjlay.de> <4E750621.3060505@gjlay.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-09/txt/msg00148.txt.bz2 Jonathan Wakely schrieb: > On 17 September 2011 21:42, Georg-Johann Lay wrote: > >>Jonathan Wakely schrieb: >> >>>On 17 September 2011 21:32, Georg-Johann Lay wrote: >>> >>> >>>>Hi, compiled with -Wall -Wextra the wollowing lines don't complain about >>>>a >>>>being used uninitialized. Tried with 4.5 and 4.6. Am I missing >>>>something? >>>> >>>>int func (void) >>>>{ >>>> int a = a; >>>> >>>> return a; >>>>} >>> >>>Yes, you're missing -Winit-self >> >>Thanks. >> >>Confusing... extra option for that? > > Maybe, but it's documented, so that makes it ok! > >>The message with -Wuninitialized -Winit-self is >>warning: 'a' is used uninitialized in this function [-Wuninitialized] >> >>Is there a special reason why this is not part of Wall or Wextra? > > Initialising a variable with itself is a GNU extension, used to > suppress warnings about uninitialised variables when you *really* > don't want to initialise a variable and don't want a warning either. Thanks for the explanation, now I understand it. > Personally I think it's an abomination :)