https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64639

--- Comment #3 from Chengnian Sun <chengniansun at gmail dot com> ---
(In reply to Chengnian Sun from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > "(a = 0) != 0" has a side effect of setting a to 0.
> > 
> > I think in this case, clang is incorrectly warning about it.
> 
> I agree that (a = 0) has a side effect, but the comparison "!=" is not used.

Please refer to the following test program. GCC emits a warning for the
expression "(a = 0) != 0".


$: cat t.c
int a;
void f() {
  (a = 0) != 0;
}
$: gcc-trunk -c -Wunused-value t.c
t.c: In function ¡®f¡¯:
t.c:3:11: warning: value computed is not used [-Wunused-value]
   (a = 0) != 0;
           ^

Reply via email to