NetBSD Problem Report #49493
From www@NetBSD.org Sun Dec 21 21:19:26 2014
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 927AAA6553
for <gnats-bugs@gnats.NetBSD.org>; Sun, 21 Dec 2014 21:19:26 +0000 (UTC)
Message-Id: <20141221211924.73238A65B9@mollari.NetBSD.org>
Date: Sun, 21 Dec 2014 21:19:24 +0000 (UTC)
From: Antoine.Leca.1@gmail.com
Reply-To: Antoine.Leca.1@gmail.com
To: gnats-bugs@NetBSD.org
Subject: clang warning about uninitialized in ipfilter without INET6
X-Send-Pr-Version: www-1.0
>Number: 49493
>Category: kern
>Synopsis: clang warning about uninitialized in ipfilter without INET6
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: support
>Submitter-Id: net
>Arrival-Date: Sun Dec 21 21:20:00 +0000 2014
>Originator: Antoine Leca
>Release: current as about 2014-12-07
>Organization:
>Environment:
NetBSD/i386 from http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD-llvm/201411160850Z/images/NetBSD-7.99.1-i386-install.img.gz
(sorry, that kernel is not available any more for uname)
>Description:
While building with clang a new kernel *without* INET6, I got
...
compile NB100/ip_proxy.o
In file included from /usr/src/sys/external/bsd/ipf/netinet/ip_proxy.c:92:
/usr/src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:500:6: error: variable 'nat2' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (nat->nat_v[0] == 6) {
^~~~~~~~~~~~~~~~~~
/usr/src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:527:6: note: uninitialized use occurs here
if (nat2 != NULL)
^~~~
/usr/src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:500:2: note: remove the 'if' if its condition is always false
if (nat->nat_v[0] == 6) {
^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:443:13: note: initialize the variable 'nat2' to silence this warning
nat_t *nat2;
^
= NULL
1 error generated.
*** Failed target: ip_proxy.o
*** Failed command: echo ' ' "compile NB100/ip_proxy.o" && : echo /usr/lltools/bin/i486--netbsdelf-clang -msoft-float -mno-mmx -mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss -O2 -fno-omit-frame-pointer -fstack-protector -Wstack-protector --param ssp-buffer-size=1 -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes -Wextra -Wno-unused-parameter -Wold-style-definition -Wno-sign-compare -Wno-unknown-pragmas -Wno-conversion -Wno-self-assign --sysroot=/home/antoine/obj.ll07/destdir.i386 -Di386 -I. -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DDIAGNOSTIC -DMAXUSERS=8 -D_KERNEL -D_KERNEL_OPT -std=gnu99 -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string
-I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string -D_FORTIFY_SOURCE=2 -I/usr/src/sys/external/bsd/ipf -I/usr/src/sys/external/isc/atheros_hal/dist -I/usr/src/sys/external/isc/atheros_hal/ic -I/usr/src/sys/external/bsd/drm2/include -I/usr/src/sys/external/bsd/common/include -I/usr/src/sys/external/bsd/drm2/include -I/usr/src/sys/external/bsd/drm2/dist -I/usr/src/sys/external/bsd/drm2/dist/include -I/usr/src/sys/external/bsd/drm2/dist/include/drm -I/usr/src/sys/external/bsd/drm2/dist/uapi -I/usr/src/sys/external/bsd/common/include -D__KERNEL__ -I/usr/src/sys/../common/include -DCONFIG_AGP -I/usr/src/sys/external/bsd/drm2/dist/drm/i915 -I/usr/src/sys/external/bsd/drm2/i915drm -DCONFIG_DRM_I915_FBDEV -I/usr/src/sys/external/bsd/acpica/dist/include -c /usr/src/sys/external/bsd/ipf/netinet/ip_proxy.c && /usr/lltools/bin/i486--netbsdelf-clang -msoft-float -mno-mmx -mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss -O2 -fno-omit-frame-pointer -fstack-pr
otector -Wstack-protector --param ssp-buffer-size=1 -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes -Wextra -Wno-unused-parameter -Wold-style-definition -Wno-sign-compare -Wno-unknown-pragmas -Wno-conversion -Wno-self-assign --sysroot=/home/antoine/obj.ll07/destdir.i386 -Di386 -I. -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DDIAGNOSTIC -DMAXUSERS=8 -D_KERNEL -D_KERNEL_OPT -std=gnu99 -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string -D_FORTIFY_SOURCE=2 -I/usr/src/sys/external/bsd/ipf -I/usr/src/sys/external/isc/atheros_hal/dist -I/usr/src/sys/external/isc/atheros_hal/ic -I/usr/src/sys/ex
ternal/bsd/drm2/include -I/usr/src/sys/external/bsd/common/include -I/usr/src/sys/external/bsd/drm2/include -I/usr/src/sys/external/bsd/drm2/dist -I/usr/src/sys/external/bsd/drm2/dist/include -I/usr/src/sys/external/bsd/drm2/dist/include/drm -I/usr/src/sys/external/bsd/drm2/dist/uapi -I/usr/src/sys/external/bsd/common/include -D__KERNEL__ -I/usr/src/sys/../common/include -DCONFIG_AGP -I/usr/src/sys/external/bsd/drm2/dist/drm/i915 -I/usr/src/sys/external/bsd/drm2/i915drm -DCONFIG_DRM_I915_FBDEV -I/usr/src/sys/external/bsd/acpica/dist/include -c /usr/src/sys/external/bsd/ipf/netinet/ip_proxy.c && :
*** Error code 1
Stop.
nbmake: stopped in /home/antoine/obj.ll07/sys/arch/i386/compile/NB100
>How-To-Repeat:
* Take a system compiled by LLVM (HEAD-LLVM) on i386
* Create a variant configuration disabling INET6, name it NB100
$ ./build.sh -u -U -T /usr/lltools/ -O /home/antoine/obj.ll07/ -V HOST_CC=clang -V HOST_CXX=clang++ -V HAVE_LLVM=1 -V MKLLVM=yes -V MKSTDLICXX=yes -V MKGCC=no -V MKGCCCMDS=no -V SLOPPY_FLIST=yes -N1 kernel=NB100
>Fix:
I went on with the proposed
nat_t *nat2 = NULL;
but it is completely beyond me to know if NULL is the correct initial value on line 443, or even whether the analysis performed by the compiler is indeed correct or not.
I only noticed that a similar fix was applied for the same reason (no INET6) on line 837 of the same ip_ftp_pxy.c file
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.