This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/45278] New: -Wextra doesn't warn about (pointer < 0 ).
- From: "pluto at agmk dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Aug 2010 16:25:00 -0000
- Subject: [Bug other/45278] New: -Wextra doesn't warn about (pointer < 0 ).
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
$ cat ptr.cpp
extern void* p;
int main() { return ( p<0 ? 1 : 0 ); }
$ g++ ptr.cpp -Wall -Wextra -O2 -S -fdump-tree-optimized
int main() ()
{
<bb 2>:
return 0;
}
gcc manual:
"The option -Wextra also prints warning messages for the following cases:
· A pointer is compared against integer zero with <, <=, >, or >=."
so, this looks like a missed-diagnostics.
--
Summary: -Wextra doesn't warn about (pointer < 0 ).
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pluto at agmk dot net
GCC build triplet: x86_64-gnu-linux
GCC host triplet: x86_64-gnu-linux
GCC target triplet: x86_64-gnu-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45278