public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gdr at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/5310] Weird warnings about using (int)NULL
Date: Wed, 30 Nov 2005 19:15:00 -0000	[thread overview]
Message-ID: <20051130191509.23017.qmail@sourceware.org> (raw)
In-Reply-To: <bug-5310-2018@http.gcc.gnu.org/bugzilla/>



------- 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


       reply	other threads:[~2005-11-30 19:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
2005-11-30 19:15 ` gdr at gcc dot gnu dot org [this message]
2007-01-09 15:30 ` manu at gcc dot gnu dot org
2007-05-23  0:50 ` manu at gcc dot gnu dot org
2007-05-23  0:51 ` manu at gcc dot gnu dot org
2007-11-12  1:15 ` manu at gcc dot gnu dot org
2007-11-15 20:05 ` patchapp at dberlin dot org
2007-11-23 19:15 ` manu at gcc dot gnu dot org
2007-11-23 19:16 ` manu at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051130191509.23017.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).