From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22048 invoked by alias); 28 Oct 2016 20:10:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 22036 invoked by uid 89); 28 Oct 2016 20:10:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=Bergmann, bergmann, uninit, tends X-HELO: zimbra.cs.ucla.edu Subject: Re: [PATCH] Fix -Os related -Werror failures. To: Arnd Bergmann , libc-alpha@sourceware.org References: <6eac682f-26fa-6a47-9497-357206266ba1@redhat.com> <6be7dce5-bfa7-32c7-5bac-6c3b79776683@redhat.com> <9d58289e-07fb-4bae-d7d3-8055a6c96a3a@redhat.com> <20863164.XNWC5rYB1g@wuerfel> Cc: Jeff Law , Florian Weimer , Carlos O'Donell From: Paul Eggert Message-ID: <7820c555-1463-6c3a-17e5-650a44fabd19@cs.ucla.edu> Date: Fri, 28 Oct 2016 20:10:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20863164.XNWC5rYB1g@wuerfel> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00565.txt.bz2 On 10/28/2016 01:12 AM, Arnd Bergmann wrote: > I found that most often when gcc is confused about whether a variable is uninitialized or not, the source code tends to be confusing to a human reader as well and rewriting it differently results in better readability and better object code while avoiding the warning. I'm afraid my experience has not been so good. Maybe 1/3 of the time rewriting is better, but otherwise rewriting doesn't help or even confuses the code. When that happens with -Wmaybe-uninitialized, in Emacs we typically use C declarations like this: ptrdiff_t offset2 UNINIT; /* The UNINIT works around GCC bug 78081. */ where UNINIT is defined something like this: #ifdef GCC_LINT # define UNINIT = {0,} #else # define UNINIT /* empty */ #endif and configuring with --enable-gcc-warnings compiles with something like 'gcc -Wall -Werror -DGCC_LINT'.