From patchwork Tue Jan 28 14:36:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Schwinge X-Patchwork-Id: 314730 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id DB5FC2C0079 for ; Wed, 29 Jan 2014 01:37:05 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; q=dns; s=default; b=GqcsKoJJm0+WB7xU 4yR0hSvULYpJt0dDtj2+NOmSH9yeULKXlYtpPS4HqeGSJuSKE6Ib2cw7Y+s2mABk 0zpagzvqgdxDB8Q2SXHQcffBfh70m4aJvbIm8UOrvPiENzEn4PwNV2Um4YTxuW9b sWKIUMfyC/hcfYjm4nEUV0Ws0FY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-type; s=default; bh=nSMjnkvDQqsoZJv49z5ICe /XhmU=; b=PamIuBLR8a1QuOICkG1pgy3oYyHkIqQrgiPNE9D43ZS1cEYQJN0n/3 StNRBH9XXUNvKZn60s+IEeZIKgWF99NsHESlvszka54P8HvR7rpWABBgT54jNr90 kfWRxkC1VPOyQaEyjR22lKSmg0DYXapHYwAjIxjVlKW9aXbfjlCt4= Received: (qmail 9535 invoked by alias); 28 Jan 2014 14:36:58 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 9516 invoked by uid 89); 28 Jan 2014 14:36:57 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 28 Jan 2014 14:36:56 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1W89mW-0002tf-Kx from Thomas_Schwinge@mentor.com ; Tue, 28 Jan 2014 06:36:52 -0800 Received: from SVR-IES-FEM-02.mgc.mentorg.com ([137.202.0.106]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Tue, 28 Jan 2014 06:36:52 -0800 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-02.mgc.mentorg.com (137.202.0.106) with Microsoft SMTP Server id 14.2.247.3; Tue, 28 Jan 2014 14:36:50 +0000 From: Thomas Schwinge To: CC: Ian Lance Taylor , Dmitry Vyukov , Alexey Samsonov , Konstantin Serebryany , Jakub Jelinek Subject: -Og bug? (was: [PATCH] libsanitizer demangling using cp-demangle.c) In-Reply-To: <20131210113834.GQ892@tucnak.redhat.com> References: <20131206075033.GE892@tucnak.redhat.com> <20131206082507.GF892@tucnak.redhat.com> <20131206095337.GH892@tucnak.redhat.com> <20131210113834.GQ892@tucnak.redhat.com> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Tue, 28 Jan 2014 15:36:44 +0100 Message-ID: <87bnyw41hf.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Hi! This got committed to trunk as r206477; one small nit: On Tue, 10 Dec 2013 12:38:34 +0100, Jakub Jelinek wrote: > * libbacktrace/Makefile.am (libsanitizer_libbacktrace_la_SOURCES): Add > ../../libiberty/cp-demangle.c. Trying to build trunk r207180 with C*FLAGS='-Og -ggdb', a compiler warning in cp-demangle.c (as seen for other instances of cp-demangle.c being built) is promoted to a hard error in the libsanitizer context, due to -Werror usage: libtool: compile: [...]/build/./gcc/xgcc -B[...]/build/./gcc/ -B[...]/install/x86_64-unknown-linux-gnu/bin/ -B[...]/install/x86_64-unknown-linux-gnu/lib/ -isystem [...]/install/x86_64-unknown-linux-gnu/include -isystem [...]/install/x86_64-unknown-linux-gnu/sys-include -DHAVE_CONFIG_H -I. -I../../../../source/libsanitizer/libbacktrace -I.. -I ../../../../source/libsanitizer/../include -I ../../../../source/libsanitizer/../libgcc -I ../../libgcc -I .. -I ../../../../source/libsanitizer -I ../../../../source/libsanitizer/../libbacktrace -W -Wall -Wwrite-strings -Wmissing-format-attribute -Wcast-qual -Werror -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -g -O2 -Og -ggdb -MT cp-demangle.lo -MD -MP -MF .deps/cp-demangle.Tpo -c ../../../../source/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c -fPIC -DPIC -o .libs/cp-demangle.o ../../../../source/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c: In function 'd_demangle_callback': ../../../../source/libsanitizer/libbacktrace/../../libiberty/cp-demangle.c:5842:14: error: 'dc' may be used uninitialized in this function [-Werror=maybe-uninitialized] : 0; ^ cc1: all warnings being treated as errors make[4]: *** [cp-demangle.lo] Error 1 make[4]: Leaving directory `[...]/build/x86_64-unknown-linux-gnu/libsanitizer/libbacktrace' GCC fails to track that all the possible values for enum type indeed have been covered, and so dc must have been initialized. As the warning/error does not appear with -O0, is this in fact a -Og bug? If not, solve this by initializing dc to NULL (lame...) ;-), or maybe as follows? Avoid "'dc' may be uninitialized" warning. libiberty/ * cp-demangle.c (d_demangle_callback): Put __builtin_unreachable in place, to help the compiler. Grüße, Thomas --- libiberty/cp-demangle.c +++ libiberty/cp-demangle.c @@ -5824,6 +5824,8 @@ d_demangle_callback (const char *mangled, int options, NULL); d_advance (&di, strlen (d_str (&di))); break; + default: + __builtin_unreachable (); } /* If DMGL_PARAMS is set, then if we didn't consume the entire