Re: [PATCH] uio.c: Fix warning: 'ret' might be used uninitialized
From: Vitalii Demianets
Date: Tue Nov 27 2012 - 07:24:37 EST
By the way, I've found that warning while working on the older kernel with
older gcc (ver. 3.4.4). The modern gcc (ver. 4.5.4) does not emit that
warning no matter how hard I try. For example, it does not warn even with the
following line in the drivers/uio/Makefile:
ccflags-$(CONFIG_UIO) += -O2 -Wall -Wextra -Wuninitialized
In that case the actual command line looks like (from "make V=1" output):
gcc -Wp,-MD,drivers/uio/.uio.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.4/include -I/home/vitas/Progs/net-next/net-next/arch/x86/include -Iarch/x86/include/generated -Iinclude -I/home/vitas/Progs/net-next/net-next/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/home/vitas/Progs/net-next/net-next/include/uapi -Iinclude/generated/uapi -include /home/vitas/Progs/net-next/net-next/include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_AVX=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -Wframe-larger-than=2048 -fno-stack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -DCC_HAVE_ASM_GOTO -O2 -Wall -Wextra -Wuninitialized -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(uio)" -D"KBUILD_MODNAME=KBUILD_STR(uio)" -c -o
drivers/uio/uio.o drivers/uio/uio.c
I wander why doesn't modern gcc warn about obvious use of uninitialized
variable. Is it some known regression in gcc?
--
With Best Regards,
Vitalii Demianets
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/