[Bug sanitizer/79572] [6/7 Regression] reference binding to null pointer not reported with -fsanitize=undefined
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 17 11:48:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79572
--- Comment #9 from janus at gcc dot gnu.org ---
(In reply to Richard Biener from comment #8)
> Btw, clang behaves the same:
True. But at least clang 3.9 has some additional diagnostics:
null_ref.cpp:11:5: warning: binding dereferenced null pointer to reference has
undefined behavior [-Wnull-dereference]
f(*((int*) NULL));
^~~~~~~~~~~~~~
Ideally GCC should yield the same warning, and maybe even turn it into an error
with -std=c++14, as opposed to -std=gnu++14 ?
More information about the Gcc-bugs
mailing list