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

            Bug ID: 64639
           Summary: false negative of -Wunused-value
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chengniansun at gmail dot com

I think GCC should also warn that the value of the expression "(a = 0) != 0" is
not used. 

$: cat s.c
int *a;
int b;
void f() { 
  b = (0, (a = 0) != 0, 0);
}
$: 
$: gcc-trunk -c -Wunused-value s.c
s.c: In function ‘f’:
s.c:4:9: warning: left-hand operand of comma expression has no effect
[-Wunused-value]
   b = (0, (a = 0) != 0, 0);
         ^
$: 
$: clang-trunk -c -Wunused-value s.c
s.c:4:8: warning: expression result unused [-Wunused-value]
  b = (0, (a = 0) != 0, 0);
       ^
s.c:4:19: warning: expression result unused [-Wunused-value]
  b = (0, (a = 0) != 0, 0);
          ~~~~~~~ ^  ~
2 warnings generated.
$: 
$:

Reply via email to