From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23042 invoked by alias); 30 Nov 2005 19:15:11 -0000 Received: (qmail 23018 invoked by uid 48); 30 Nov 2005 19:15:09 -0000 Date: Wed, 30 Nov 2005 19:15:00 -0000 Message-ID: <20051130191509.23017.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c++/5310] Weird warnings about using (int)NULL In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "gdr at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2005-11/txt/msg04149.txt.bz2 List-Id: ------- Comment #3 from gdr at gcc dot gnu dot org 2005-11-30 19:15 ------- (In reply to comment #2) > On the mainline (20030526), I only get one warning: > > pr5310.cc: In function `void bar()': > pr5310.cc:9: warning: passing NULL used for non-pointer argument 1 of `void > foo(int)' > > Here is the proprocessed form of the testcase: > void foo (int); > void foo (long); > > void bar() > { > foo ((int)__null); > foo ((long)__null); > } The issue here has several roots: (1) cp/call.c:convert_like_real() should warn only if !c_cast_p; (2) convert_like_real() was called (as convert_like_with_context) with c_cast_p set to false; which is one source of the bug (3) since __null is of type int, the cast to int was a no-op, and since the C++ front-end currently does not have a high level representation of the program (e.g. lowering is done as part of parsing), it does not have ways to make the difference. Patches to correct any point above will be a progress. -- gdr at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gdr at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5310