This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/18624] GCC does not detect local variable set but never used



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]