From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30709 invoked by alias); 5 Apr 2012 20:44:57 -0000 Received: (qmail 30689 invoked by uid 22791); 5 Apr 2012 20:44:55 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 05 Apr 2012 20:44:34 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 745461C675E; Thu, 5 Apr 2012 16:44:33 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ASh-7lgMOU93; Thu, 5 Apr 2012 16:44:33 -0400 (EDT) Received: from [192.168.77.102] (cpe-69-204-224-43.nyc.res.rr.com [69.204.224.43]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 013631C6617; Thu, 5 Apr 2012 16:44:32 -0400 (EDT) Message-ID: <4F7E042C.7040600@adacore.com> Date: Thu, 05 Apr 2012 20:44:00 -0000 From: Robert Dewar User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1 MIME-Version: 1.0 To: Russ Allbery CC: gcc Subject: Re: RFC: -Wall by default References: <4F7D5EB4.2060903@redhat.com> <20120405100409.GA5596@adacore.com> <20120405101630.GA9348@adacore.com> <20120405102945.GA11234@adacore.com> <87fwci53lj.fsf@windlord.stanford.edu> In-Reply-To: <87fwci53lj.fsf@windlord.stanford.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg00207.txt.bz2 On 4/5/2012 4:24 PM, Russ Allbery wrote: > Gabriel Dos Reis writes: > >> If it is the non-expert that would be caught in code so non-obvious that >> -Wuninitialized would trip into false positives, then it is highly >> likely that the code might in fact contain an error. > > I wish this were the case, but alas I continue to see fairly trivial false > positives from -Wuninitialized. Usually cases where the initialization > and the use are both protected by equivalent conditionals at different > places in the function. Yes, and often it is not so easy for the compiler to see that the conditionals are always the same > > Personally, as a matter of *style*, I eliminate such cases either by > initializing the variable or restructuring the function. But this is very > much a question of style, not of correctness. Indeed, and for me, when you are forced to do an initialization like this, it is mandatory to comment why you are initializing it, otherwise it obscures the code ("why is this being initialized, where is that value used?") and that ends up junky IMO. The Ada front end unfortunately has quite a few such commented junk initializations. >