$ 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:
 &#183; 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

Reply via email to