From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 127149 invoked by alias); 28 Oct 2016 12:43:55 -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 127134 invoked by uid 89); 28 Oct 2016 12:43:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RP_MATCHES_RCVD,SPF_HELO_PASS,UNSUBSCRIBE_BODY autolearn=no version=3.3.2 spammy=indicator, distraction, hides, worried X-HELO: mx1.redhat.com Subject: Re: [PATCH] Fix -Os related -Werror failures. To: "Carlos O'Donell" , GNU C Library References: <6eac682f-26fa-6a47-9497-357206266ba1@redhat.com> <6be7dce5-bfa7-32c7-5bac-6c3b79776683@redhat.com> From: Florian Weimer Message-ID: Date: Fri, 28 Oct 2016 12:43: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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00517.txt.bz2 On 10/28/2016 02:08 PM, Carlos O'Donell wrote: > On 10/28/2016 02:32 AM, Florian Weimer wrote: >> On 10/28/2016 06:46 AM, Carlos O'Donell wrote: >>> +/* With GCC 5.3 when compiling with -Os the compiler emits a warning >>> + that buf[0] and buf[1] may be used uninitialized. This can only >>> + happen in the case where tmpbuf[3] is used, and in that case the >>> + write to the tmpbuf[1] and tmpbuf[2] was assured because >>> + ucs4_to_cns11643 would have filled in those entries. The difficulty >>> + is in getting the compiler to see this logic because tmpbuf[0] is >>> + involved in determining the code page and is the indicator that >>> + tmpbuf[2] is initialized. */ >>> +DIAG_PUSH_NEEDS_COMMENT; >>> +DIAG_IGNORE_NEEDS_COMMENT (5.3, "-Wmaybe-uninitialized"); >> >> This hides the warning for -O2 builds as well, so I don't think this is a good idea. >> >> Those who want to build with -Os or other special compiler flags >> should just configure with --disable-werror. We can't account for >> every optimization someone might want to disable in their build. > > I agree that we can't account for _all_ optimizations someone might want > to disable in their build, but I think it is a reasonable goal to target > a few key _default_ optimization including -O3, -O2, and -Os. > > In the case above we only limit the emitted warnings for the narrow > code involved in iso-2022-cn-ext conversions. I'd be more worried if it > required a widely used function with broadly disabled warnings. We can probably find a compiler flag which needs this for a central function. This might not look like a lot of work now, but it's an ongoing effort, for every target, GCC version, and flag variant. It does not help default builds at all (in fact, it has some slight risk interfering with future development because we might miss some warning as a result). I think it's just a distraction. And with -Os in particular, the resulting libc is not really ABI-compliant. Florian