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

            Bug ID: 64648
           Summary: Incorrect message description 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

GCC emits a -Wunused-value warning with a wrong description for the expression
"(a = 0) >= 0". There is no comma expression, but the message is 

        right-hand operand of comma expression has no effect

If I change the operator from ">=" to "!=", then the message is correct. 




$: cat t.c
int a;
void f() {
  (a = 0) != 0;
  (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;
           ^
t.c:4:11: warning: right-hand operand of comma expression has no effect
[-Wunused-value]
   (a = 0) >= 0;
           ^
$: 
$: clang-trunk -c -Wunused-value t.c
t.c:3:11: warning: inequality comparison result unused [-Wunused-comparison]
  (a = 0) != 0;
  ~~~~~~~~^~~~
t.c:4:11: warning: relational comparison result unused [-Wunused-comparison]
  (a = 0) >= 0;
  ~~~~~~~~^~~~
2 warnings generated.
$:

Reply via email to