This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/5310] Weird warnings about using (int)NULL



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]