[Bug c/18624] GCC does not detect local variable set but never used
aldot at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Nov 25 18:16:00 GMT 2009
------- Comment #19 from aldot at gcc dot gnu dot org 2009-11-25 18:15 -------
(In reply to comment #18)
> http://gcc.gnu.org/ml/gcc-patches/2009-11/msg01392.html
>
Wunused-var-1.c has these two tests:
void
f1 (void)
{
int a; /* { dg-warning "set but not used" } */
int b;
int c;
c = 1;
a = b = c;
}
Neither of them has side-effects nor is actually used, so warnings for all of
them should be emitted.
void
f2 (int x)
{
int a; /* { dg-warning "set but not used" } */
int b;
int c; /* { dg-warning "set but not used" } */
c = (a = x, b = x);
}
Same here AFAICS, also the PARM_DECL is unused.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18624
More information about the Gcc-bugs
mailing list