From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15145 invoked by alias); 26 Jul 2007 21:50:22 -0000 Received: (qmail 15129 invoked by uid 22791); 26 Jul 2007 21:50:21 -0000 X-Spam-Check-By: sourceware.org Received: from sunsite.ms.mff.cuni.cz (HELO sunsite.mff.cuni.cz) (195.113.15.26) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 26 Jul 2007 21:50:20 +0000 Received: from sunsite.mff.cuni.cz (localhost.localdomain [127.0.0.1]) by sunsite.mff.cuni.cz (8.13.8/8.13.8) with ESMTP id l6QLsaKV027332; Thu, 26 Jul 2007 23:54:36 +0200 Received: (from jakub@localhost) by sunsite.mff.cuni.cz (8.13.8/8.13.8/Submit) id l6QLsa5I027331; Thu, 26 Jul 2007 23:54:36 +0200 Date: Thu, 26 Jul 2007 21:50:00 -0000 From: Jakub Jelinek To: Ulrich Drepper Cc: Glibc hackers Subject: [PATCH] Maybe uninitialized var warning workarounds Message-ID: <20070726215436.GM4603@sunsite.mff.cuni.cz> Reply-To: Jakub Jelinek Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Mailing-List: contact libc-hacker-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-hacker-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00047.txt.bz2 Hi! These are workarounds for warnings, though aren't terribly expensive and aren't in performance critical code. Neither gcc 4.1 nor 4.3 is able to figure these cases. 2007-07-26 Jakub Jelinek * nscd/selinux.c (preserve_capabilities): Initialize new_caps to avoid warning. * iconv/gconv_open.c (__gconv_open): Initialize ptr to avoid warning. * nis/nis_subr.c (nis_getnames): Initialize saveptr to avoid warning. * resolv/inet_ntop.c (inet_ntop6): Initialize best.len and cur.len to avoid warnings. --- libc/nscd/selinux.c.jj 2007-04-23 10:54:02.000000000 +0200 +++ libc/nscd/selinux.c 2007-07-26 13:17:14.000000000 +0200 @@ -180,7 +180,7 @@ preserve_capabilities (void) } cap_t tmp_caps = cap_init (); - cap_t new_caps; + cap_t new_caps = NULL; if (tmp_caps != NULL) new_caps = cap_init (); --- libc/iconv/gconv_open.c.jj 2005-12-21 08:27:27.000000000 +0100 +++ libc/iconv/gconv_open.c 2007-07-26 13:17:14.000000000 +0200 @@ -1,5 +1,5 @@ /* Find matching transformation algorithms and initialize steps. - Copyright (C) 1997,1998,1999,2000,2001,2004,2005 + Copyright (C) 1997,1998,1999,2000,2001,2004,2005,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -56,7 +56,7 @@ __gconv_open (const char *toset, const c /* Make copy without the error handling description. */ char *newtoset = (char *) alloca (errhand - toset + 1); char *tok; - char *ptr; + char *ptr = NULL /* Work around a bogus warning */; newtoset[errhand - toset] = '\0'; toset = memcpy (newtoset, toset, errhand - toset); --- libc/nis/nis_subr.c.jj 2006-12-11 21:31:22.000000000 +0100 +++ libc/nis/nis_subr.c 2007-07-26 13:41:45.000000000 +0200 @@ -112,7 +112,7 @@ nis_getnames (const_nis_name name) size_t name_len = strlen (name); char *path; int pos = 0; - char *saveptr; + char *saveptr = NULL; int have_point; const char *cp; const char *cp2; --- libc/resolv/inet_ntop.c.jj 2007-05-04 11:38:29.000000000 +0200 +++ libc/resolv/inet_ntop.c 2007-07-26 13:17:14.000000000 +0200 @@ -138,6 +138,8 @@ inet_ntop6(src, dst, size) words[i / 2] = (src[i] << 8) | src[i + 1]; best.base = -1; cur.base = -1; + best.len = 0; + cur.len = 0; for (i = 0; i < (NS_IN6ADDRSZ / NS_INT16SZ); i++) { if (words[i] == 0) { if (cur.base == -1) Jakub