This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70180] missing -Wpointer-arith on NULL arithmetic cast to a an object type
- From: "egallager at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 28 Aug 2017 12:14:49 +0000
- Subject: [Bug c++/70180] missing -Wpointer-arith on NULL arithmetic cast to a an object type
- Auto-submitted: auto-generated
- References: <bug-70180-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70180
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic, documentation
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-08-28
CC| |egallager at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
I updated your example to include the additional cases you mentioned:
$ cat 70180.cc
#include <stddef.h>
void *p = (int*)NULL + 1;
void *q = (int*)NULL + 0;
void *r = (void *)((int*)NULL - (int*)NULL);
$ /usr/local/bin/gcc -c -S -Wall -Wextra -Wpedantic -Werror -xc 70180.cc
$ /usr/local/bin/g++ -c -S -Wall -Wextra -Wpedantic -Werror -xc++ 70180.cc
$
Confirmed.