[Bug c++/70194] New: [6 regression] missing -Waddress on constexpr pointer
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 11 17:13:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70194
Bug ID: 70194
Summary: [6 regression] missing -Waddress on constexpr pointer
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
GCC 5 and prior issue a -Waddress warning for each of the equality expressions
in the test case below. The current top of GCC 6.0 trunk doesn't diagnose the
second equality expression where the address being compared is stored in a
constexpr pointer.
$ (set -x; cat v.c && ~/bin/gcc-5.1.0/bin/g++ -S -Wall -Wextra -Wpedantic
-o/dev/null -std=c++14 -xc++ v.c && /home/msebor/build/gcc-trunk-git/gcc/xgcc
-B/home/msebor/build/gcc-trunk-git/gcc -S -Wall -Wextra -Wpedantic -o/dev/null
-xc++ v.c)
+ cat v.c
int i;
const bool b0 = &i == 0;
constexpr int *p = &i;
const bool b1 = p == 0;
+ /home/msebor/bin/gcc-5.1.0/bin/g++ -S -Wall -Wextra -Wpedantic -o/dev/null
-std=c++14 -xc++ v.c
v.c:3:23: warning: the address of ‘i’ will never be NULL [-Waddress]
const bool b0 = &i == 0;
^
v.c:6:22: warning: the address of ‘i’ will never be NULL [-Waddress]
const bool b1 = p == 0;
^
+ /home/msebor/build/gcc-trunk-git/gcc/xgcc
-B/home/msebor/build/gcc-trunk-git/gcc -S -Wall -Wextra -Wpedantic -o/dev/null
-xc++ v.c
v.c:3:23: warning: the address of ‘i’ will never be NULL [-Waddress]
const bool b0 = &i == 0;
^
More information about the Gcc-bugs
mailing list