From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12742 invoked by alias); 27 Apr 2010 03:30:19 -0000 Received: (qmail 12464 invoked by uid 48); 27 Apr 2010 03:29:55 -0000 Date: Tue, 27 Apr 2010 03:30:00 -0000 Subject: [Bug c++/43906] New: missing warnings the comparison between an address with a null pointer constant X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pzhao at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-04/txt/msg02812.txt.bz2 As Manuel mentioned at http://gcc.gnu.org/ml/gcc-patches/2010-04/msg01425.html. C++ have the same problem as pr32207. extern void z(); void f() { if ( z ) z(); } void g() { if ( z != 0 ) z(); } void h() { if ( z != (void*)0 ) z(); } t.C: In function ‘void f()’: t.C:2:19: warning: the address of ‘void z()’ will always evaluate as ‘true’ [-Waddress] t.C: In function ‘void g()’: t.C:3:22: warning: the address of ‘void z()’ will never be NULL [-Waddress] -- Summary: missing warnings the comparison between an address with a null pointer constant Product: gcc Version: 4.6.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pzhao at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43906