This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/64648] New: Incorrect message description of -Wunused-value
- From: "chengniansun at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 17 Jan 2015 18:59:08 +0000
- Subject: [Bug c/64648] New: Incorrect message description of -Wunused-value
- Auto-submitted: auto-generated
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.
$: