https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78987
Bug ID: 78987
Summary: Wrong location of a binary expression for -Waddress
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
Target Milestone: ---
Starting from 4.8, where location description was added.
$ cat /tmp/wrong-conditions.c
void foo() {}
void bar() {}
void baz() {}
int main2(int argc, int argc2)
{
if (foo && bar && baz)
return 1;
return 0;
}
$ ./xgcc -B. /tmp/wrong-conditions.c -c -Wall
/tmp/wrong-conditions.c: In function ‘main2’:
/tmp/wrong-conditions.c:7:7: warning: the address of ‘foo’ will always evaluate
as ‘true’ [-Waddress]
if (foo && bar && baz)
^~~
/tmp/wrong-conditions.c:7:11: warning: the address of ‘bar’ will always
evaluate as ‘true’ [-Waddress]
if (foo && bar && baz)
^~
/tmp/wrong-conditions.c:7:18: warning: the address of ‘baz’ will always
evaluate as ‘true’ [-Waddress]
if (foo && bar && baz)
^~
Location of the first is correct, last 2 are wrong.