This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/18624] GCC does not detect local variable set but never used
- From: "dcb314 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Nov 2009 11:30:15 -0000
- Subject: [Bug c/18624] GCC does not detect local variable set but never used
- References: <bug-18624-9596@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #21 from dcb314 at hotmail dot com 2009-11-30 11:30 -------
(In reply to comment #18)
> http://gcc.gnu.org/ml/gcc-patches/2009-11/msg01392.html
I tried out your patch on a recent Linux kernel and got
some possibly false positives
Code like
static inline pud_t __pud(pudval_t val)
{
pudval_t ret;
if (sizeof(pudval_t) > sizeof(long))
ret = PVOP_CALLEE2(pudval_t, pv_mmu_ops.make_pud,
val, (u64)val >> 32);
else
ret = PVOP_CALLEE1(pudval_t, pv_mmu_ops.make_pud,
val);
return (pud_t) { ret };
}
produces
arch/x86/include/asm/paravirt.h:613:11: warning: variable 'ret' set but not
used
The return statement looks like unusual C syntax to me.
Some refinement of your patch may be possible.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18624