https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78988
Bug ID: 78988
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: ---
This is C++ equivalent of PR78987
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;
}
$ ./xg++ -B. /tmp/wrong-conditions.c -c -Wall
/tmp/wrong-conditions.c: In function ‘int main2(int, int)’:
/tmp/wrong-conditions.c:7:14: warning: the address of ‘void foo()’ will never
be NULL [-Waddress]
if (foo && bar && baz)
^~~
/tmp/wrong-conditions.c:7:14: warning: the address of ‘void bar()’ will never
be NULL [-Waddress]
/tmp/wrong-conditions.c:7:21: warning: the address of ‘void baz()’ will never
be NULL [-Waddress]
if (foo && bar && baz)
^~~
Where location of 'foo' is wrong and location for 'bar' is missing.