public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/50660] New: gcc repeats warnings twice
@ 2011-10-07 18:10 toralf.foerster at gmx dot de
  2011-10-07 18:17 ` [Bug other/50660] " redi at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: toralf.foerster at gmx dot de @ 2011-10-07 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50660
           Summary: gcc repeats warnings twice
    Classification: Unclassified
           Product: gcc
           Version: 4.5.3
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: toralf.foerster@gmx.de


Created attachment 25441
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25441
QA notice from gentoo

As seen in the attached file from Gentoo's build system few dedicated compiler
warnings are repeated .


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

* [Bug other/50660] gcc repeats warnings twice
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
@ 2011-10-07 18:17 ` redi at gcc dot gnu.org
  2011-10-07 18:21 ` [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2011-10-07 18:17 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2011-10-07
     Ever Confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-10-07 18:17:04 UTC ---
A testcase is missing, see http://gcc.gnu.org/bugs/


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

* [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
  2011-10-07 18:17 ` [Bug other/50660] " redi at gcc dot gnu.org
@ 2011-10-07 18:21 ` pinskia at gcc dot gnu.org
  2011-10-07 18:53 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-10-07 18:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
             Status|WAITING                     |NEW
   Last reconfirmed|2011-10-07 00:00:00         |
          Component|other                       |c++
            Summary|gcc repeats warnings twice  |warning about pass NULL to
                   |                            |non pointer argument
                   |                            |happens twice for template
                   |                            |function call
      Known to fail|                            |4.5.0, 4.7.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-10-07 18:20:51 UTC ---
Simplified testcase:
#include <cstddef>

template<typename T> int f(T&);
int main(void)
{
  return f<const int>(NULL);
}
--- CUT ---
t.cc: In function ‘int main()’:
t.cc:6:27: warning: passing NULL to non-pointer argument 1 of ‘int f(T&) [with
T = const int]’ [-Wconversion-null]
t.cc:6:27: warning: passing NULL to non-pointer argument 1 of ‘int f(T&) [with
T = const int]’ [-Wconversion-null]
It only happens with template functions too.

Confirmed.


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

* [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
  2011-10-07 18:17 ` [Bug other/50660] " redi at gcc dot gnu.org
  2011-10-07 18:21 ` [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call pinskia at gcc dot gnu.org
@ 2011-10-07 18:53 ` paolo.carlini at oracle dot com
  2011-10-07 18:57 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-07 18:53 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|trivial                     |normal


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

* [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
                   ` (2 preceding siblings ...)
  2011-10-07 18:53 ` paolo.carlini at oracle dot com
@ 2011-10-07 18:57 ` paolo.carlini at oracle dot com
  2011-10-07 19:32 ` paolo.carlini at oracle dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-07 18:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-07 18:57:12 UTC ---
I guess we can avoid the <cstddef>, just use __null.


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

* [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
                   ` (3 preceding siblings ...)
  2011-10-07 18:57 ` paolo.carlini at oracle dot com
@ 2011-10-07 19:32 ` paolo.carlini at oracle dot com
  2011-10-09 10:21 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-07 19:32 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-07 19:32:03 UTC ---
Something like this handles correctly the testcase and passes the testsuite,
but at the moment I don't know if we could do something else. Maybe Jason can
have a quick look...

Index: call.c
===================================================================
--- call.c    (revision 179660)
+++ call.c    (working copy)
@@ -5559,6 +5559,7 @@ convert_like_real (conversion *convs, tree expr, t
   tree totype = convs->type;
   diagnostic_t diag_kind;
   int flags;
+  int savew = warningcount;

   if (convs->bad_p && !(complain & tf_error))
     return error_mark_node;
@@ -5783,7 +5784,9 @@ convert_like_real (conversion *convs, tree expr, t

   expr = convert_like_real (convs->u.next, expr, fn, argnum,
                 convs->kind == ck_ref_bind ? -1 : 1,
-                convs->kind == ck_ref_bind ? issue_conversion_warnings :
false, 
+                convs->kind == ck_ref_bind
+                && warningcount == savew
+                ? issue_conversion_warnings : false,
                 c_cast_p,
                 complain);
   if (expr == error_mark_node)


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

* [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
                   ` (4 preceding siblings ...)
  2011-10-07 19:32 ` paolo.carlini at oracle dot com
@ 2011-10-09 10:21 ` paolo.carlini at oracle dot com
  2011-10-09 10:42 ` [Bug c++/50660] warning about pass NULL to non pointer argument happens twice paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-09 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-09 10:20:24 UTC ---
On it.


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

* [Bug c++/50660] warning about pass NULL to non pointer argument happens twice
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
                   ` (5 preceding siblings ...)
  2011-10-09 10:21 ` paolo.carlini at oracle dot com
@ 2011-10-09 10:42 ` paolo.carlini at oracle dot com
  2011-10-11  1:29 ` paolo at gcc dot gnu.org
  2011-10-11  1:30 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-09 10:42 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|warning about pass NULL to  |warning about pass NULL to
                   |non pointer argument        |non pointer argument
                   |happens twice for template  |happens twice
                   |function call               |

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-09 10:42:19 UTC ---
Note, happens twice also for non-template:

int g(const int&);
int m2()
{
  return g(__null);
}


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

* [Bug c++/50660] warning about pass NULL to non pointer argument happens twice
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
                   ` (6 preceding siblings ...)
  2011-10-09 10:42 ` [Bug c++/50660] warning about pass NULL to non pointer argument happens twice paolo.carlini at oracle dot com
@ 2011-10-11  1:29 ` paolo at gcc dot gnu.org
  2011-10-11  1:30 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-10-11  1:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-10-11 01:28:37 UTC ---
Author: paolo
Date: Tue Oct 11 01:28:34 2011
New Revision: 179779

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179779
Log:
2011-10-10  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/50660
    * call.c (conversion_null_warnings): Don't look through references.

Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c


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

* [Bug c++/50660] warning about pass NULL to non pointer argument happens twice
  2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
                   ` (7 preceding siblings ...)
  2011-10-11  1:29 ` paolo at gcc dot gnu.org
@ 2011-10-11  1:30 ` paolo.carlini at oracle dot com
  8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-11  1:30 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|jason at gcc dot gnu.org    |
         Resolution|                            |FIXED
   Target Milestone|---                         |4.7.0

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-11 01:30:07 UTC ---
Fixed for 4.7.0.


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

end of thread, other threads:[~2011-10-11  1:30 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 18:10 [Bug other/50660] New: gcc repeats warnings twice toralf.foerster at gmx dot de
2011-10-07 18:17 ` [Bug other/50660] " redi at gcc dot gnu.org
2011-10-07 18:21 ` [Bug c++/50660] warning about pass NULL to non pointer argument happens twice for template function call pinskia at gcc dot gnu.org
2011-10-07 18:53 ` paolo.carlini at oracle dot com
2011-10-07 18:57 ` paolo.carlini at oracle dot com
2011-10-07 19:32 ` paolo.carlini at oracle dot com
2011-10-09 10:21 ` paolo.carlini at oracle dot com
2011-10-09 10:42 ` [Bug c++/50660] warning about pass NULL to non pointer argument happens twice paolo.carlini at oracle dot com
2011-10-11  1:29 ` paolo at gcc dot gnu.org
2011-10-11  1:30 ` paolo.carlini at oracle dot com

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