[Bug c++/70180] missing -Wpointer-arith on NULL arithmetic cast to a an object type

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 28 13:14:00 GMT 2017


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.


More information about the Gcc-bugs mailing list