From patchwork Wed Jun 9 16:07:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jay K X-Patchwork-Id: 55109 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]) by ozlabs.org (Postfix) with SMTP id 5D253B7D4F for ; Thu, 10 Jun 2010 02:07:25 +1000 (EST) Received: (qmail 8820 invoked by alias); 9 Jun 2010 16:07:23 -0000 Received: (qmail 8802 invoked by uid 22791); 9 Jun 2010 16:07:21 -0000 X-SWARE-Spam-Status: No, hits=0.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_BJ, TW_CX, TW_DC, TW_GX, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from col0-omc3-s15.col0.hotmail.com (HELO col0-omc3-s15.col0.hotmail.com) (65.55.34.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Jun 2010 16:07:16 +0000 Received: from COL101-W56 ([65.55.34.135]) by col0-omc3-s15.col0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 9 Jun 2010 09:07:13 -0700 Message-ID: From: Jay K To: gcc-patches Subject: d_demangle_callback may use dc uninitialized, at least says gcc 4.3.2 Debian/powerpc Date: Wed, 9 Jun 2010 16:07:13 +0000 MIME-Version: 1.0 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 /home/jay/src/gcc-4.5.0/libiberty/cp-demangle.c: In function ‘d_demangle_callback’: /home/jay/src/gcc-4.5.0/libiberty/cp-demangle.c:4767: warning: ‘dc’ may be used uninitialized in this function jay@plin:~/obj/gcc45$ gcc -v Using built-in specs. Target: powerpc-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --disable-softfloat --enable-secureplt --enable-targets=powerpc-linux,powerpc64-linux --with-cpu=default32 --with-long-double-128 --enable-checking=release --build=powerpc-linux-gnu --host=powerpc-linux-gnu --target=powerpc-linux-gnu Thread model: posix gcc version 4.3.2 (Debian 4.3.2-1.1) jay@plin:~/obj/gcc45$ uname -a Linux plin 2.6.26-2-powerpc #1 Thu Feb 11 01:36:51 UTC 2010 ppc GNU/Linux The warning appears to be false:   enum     {       DCT_TYPE,       DCT_MANGLED,       DCT_GLOBAL_CTORS,       DCT_GLOBAL_DTORS     }   type;   struct demangle_component *dc; ...   if ...     type = DCT_MANGLED;   else if ...     type = ... ? DCT_GLOBAL_CTORS : DCT_GLOBAL_DTORS;   else ...       type = DCT_TYPE; ...     switch (type)       {       case DCT_TYPE:     dc = ...     break;       case DCT_MANGLED:     dc = ...     break;       case DCT_GLOBAL_CTORS:       case DCT_GLOBAL_DTORS:     ...     dc = ...     break;       }       Nevertheless: jbook2:~ jay$ diff -u /Users/jay/src/orig/gcc-4.5.0/libiberty/cp-demangle.c /Users/jay/src/gcc-4.5.0/libiberty/cp-demangle.c Appears same in gcc trunk. Optimization at least with better/newer compiler should remove the initialization but I didn't check.  - Jay --- /Users/jay/src/orig/gcc-4.5.0/libiberty/cp-demangle.c    2010-03-22 13:38:35.000000000 -0700 +++ /Users/jay/src/gcc-4.5.0/libiberty/cp-demangle.c    2010-06-09 09:00:09.000000000 -0700 @@ -4764,7 +4764,7 @@      }    type;    struct d_info di; -  struct demangle_component *dc; +  struct demangle_component *dc = { 0 };    int status;      if (mangled[0] == '_' && mangled[1] == 'Z')