public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/5310] Weird warnings about using (int)NULL
       [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
@ 2005-11-30 19:15 ` gdr at gcc dot gnu dot org
  2007-01-09 15:30 ` manu at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: gdr at gcc dot gnu dot org @ 2005-11-30 19:15 UTC (permalink / raw)
  To: gcc-bugs



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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/5310] Weird warnings about using (int)NULL
       [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
  2005-11-30 19:15 ` [Bug c++/5310] Weird warnings about using (int)NULL gdr at gcc dot gnu dot org
@ 2007-01-09 15:30 ` manu at gcc dot gnu dot org
  2007-05-23  0:50 ` manu at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-09 15:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2007-01-09 15:30 -------
(convert_like_real gives me the creeps.) 

I must check whether this warning has been taken by the new Wconversion, which
is not currently enabled by Wall.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5310


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/5310] Weird warnings about using (int)NULL
       [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
  2005-11-30 19:15 ` [Bug c++/5310] Weird warnings about using (int)NULL gdr at gcc dot gnu dot org
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-05-23  0:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from manu at gcc dot gnu dot org  2007-05-23 01:49 -------
(In reply to comment #3)

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

Where is lowering performed? It actually seems that the cast (long)__null is
performed somewhere (where?) while parsing, while (int)__null is just accepted
as __null. I tried to follow up the code with just long i = (long) __null; but
the C++ front-end is impossible to debug for me. It just jumps again and again
to the same places. Is there any trick to debug this kind of thing?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5310


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/5310] Weird warnings about using (int)NULL
       [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-05-23  0:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from manu at gcc dot gnu dot org  2007-05-23 01:50 -------
(In reply to comment #4)
> (convert_like_real gives me the creeps.) 
> 
> I must check whether this warning has been taken by the new Wconversion, which
> is not currently enabled by Wall.
> 

By the way, this is not enabled by Wall anymore. You need Wconversion for this.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5310


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/5310] Weird warnings about using (int)NULL
       [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-11-12  1:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from manu at gcc dot gnu dot org  2007-11-12 01:14 -------
*** Bug 33160 has been marked as a duplicate of this bug. ***


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5310


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/5310] Weird warnings about using (int)NULL
       [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 8+ messages in thread
From: patchapp at dberlin dot org @ 2007-11-15 20:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from patchapp at dberlin dot org  2007-11-15 20:05 -------
Subject: Bug number PR c++/5310

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg00865.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5310


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/5310] Weird warnings about using (int)NULL
       [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  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
  7 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-11-23 19:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from manu at gcc dot gnu dot org  2007-11-23 19:15 -------
Subject: Bug 5310

Author: manu
Date: Fri Nov 23 19:15:09 2007
New Revision: 130381

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130381
Log:
2007-11-23  Mark Mitchell  <mark@codesourcery.com>
            Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR c++/5310
cp/
        * call.c (convert_like_real): Build a zero constant when __null is
        converted to an integer type.
testsuite/
        * g++.dg/warn/pr5310.C: New.
        * g++.dg/warn/pr33160.C: New

Added:
    trunk/gcc/testsuite/g++.dg/warn/pr33160.C
    trunk/gcc/testsuite/g++.dg/warn/pr5310.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5310


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/5310] Weird warnings about using (int)NULL
       [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2007-11-23 19:15 ` manu at gcc dot gnu dot org
@ 2007-11-23 19:16 ` manu at gcc dot gnu dot org
  7 siblings, 0 replies; 8+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-11-23 19:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from manu at gcc dot gnu dot org  2007-11-23 19:16 -------
Fixed in GCC 4.3


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5310


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-11-23 19:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-5310-2018@http.gcc.gnu.org/bugzilla/>
2005-11-30 19:15 ` [Bug c++/5310] Weird warnings about using (int)NULL gdr at gcc dot gnu dot org
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

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