Date: Thu, 04 Jan 2018 10:01:34 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-ports-bugs@FreeBSD.org Subject: [Bug 224669] [exp-run] Against projects/clang600-import branch Message-ID: <bug-224669-13-pjkv8Sa3i1@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-224669-13@https.bugs.freebsd.org/bugzilla/> References: <bug-224669-13@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D224669 --- Comment #11 from Dimitry Andric <dim@FreeBSD.org> --- (In reply to Jan Beich from comment #10) > Notice how "comparison between pointer and integer" issue is similar to > "ordered comparison between pointer and integer". Clang prefers to not wa= rn > about possible bugs unless it's C++ or C++11. >=20 > $ cat a.c > int main() > { > const char *value[] =3D { "", "bar" }; > if (value[0] =3D=3D '\0') > return 1; > return 0; > } > $ cc a.c > $ c++ -std=3Dgnu++98 -x c++ a.c > $ gcc7 a.c > a.c: In function 'main': > a.c:4:16: warning: comparison between pointer and zero character constant > [-Wpointer-compare] > if (value[0] =3D=3D '\0') > ^~ > a.c:4:7: note: did you mean to dereference the pointer? > if (value[0] =3D=3D '\0') > ^ > $ g++7 -std=3Dgnu++98 -x c++ a.c > a.c: In function 'int main()': > a.c:4:19: warning: comparison between pointer and zero character constant > [-Wpointer-compare] > if (value[0] =3D=3D '\0') > ^~~~ > a.c:4:19: note: did you mean to dereference the pointer? Hmm I think that is actually a bit weird. I would have expected this warni= ng to always fire, but apparently not. I have not yet been able to find where this exactly changed between clang 5 and 6. In any case, these warnings point to real programming errors, so ideally th= ey should be properly patched. As a workaround USE_CXXSTD=3Dgnu++98 is fine w= ith me, though gcc still warns in that case. --=20 You are receiving this mail because: You are on the CC list for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-224669-13-pjkv8Sa3i1>