public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/26542]  New: bogus diagnostic with -pedantic?: format ‘%p’ expects type ‘void*’, but argument 2 has type ‘A*’
@ 2006-03-03  9:50 pluto at agmk dot net
  2006-03-03 11:50 ` [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*' rguenth at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: pluto at agmk dot net @ 2006-03-03  9:50 UTC (permalink / raw)
  To: gcc-bugs

$ g++ warn.cpp -Wall -ansi
no warnings.

$ g++ warn.cpp -Wall -pedantic
(...) format ‘%p’ expects type ‘void*’, but argument 2
has type ‘A*’


#include <cstdio>
struct A {};
int main()
{
    A* a = 0;
    printf("a = 0x%p\n", a);
    return 0;
}


-- 
           Summary: bogus diagnostic with -pedantic?: format
                    &#8216;%p&#8217; expects type &#8216;void*&#8217;, but
                    argument 2 has type &#8216;A*&#8217;
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
 GCC build triplet: x86-64-linux
  GCC host triplet: x86-64-linux
GCC target triplet: x86-64-linux


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


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
@ 2006-03-03 11:50 ` rguenth at gcc dot gnu dot org
  2006-03-03 12:45 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2006-03-03 11:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2006-03-03 11:50 -------
Indeed.  Not exactly useful.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
  GCC build triplet|x86-64-linux                |
   GCC host triplet|x86-64-linux                |
 GCC target triplet|x86-64-linux                |
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2006-03-03 11:50:54
               date|                            |


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


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
  2006-03-03 11:50 ` [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*' rguenth at gcc dot gnu dot org
@ 2006-03-03 12:45 ` pinskia at gcc dot gnu dot org
  2006-03-03 14:07 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-03 12:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-03-03 12:45 -------
Actually the C standard says void* only.  I don't see the issue here.


-- 


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


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
  2006-03-03 11:50 ` [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*' rguenth at gcc dot gnu dot org
  2006-03-03 12:45 ` pinskia at gcc dot gnu dot org
@ 2006-03-03 14:07 ` pinskia at gcc dot gnu dot org
  2006-07-24 17:03 ` vz-gcc at zeitlins dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-03 14:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2006-03-03 14:07 -------
This is actually expected.  From the C standard:
p The argument shall be a pointer to void. The value of the pointer is 
converted to a sequence of printing characters, in an implementation-defined 
manner. 


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
                   ` (2 preceding siblings ...)
  2006-03-03 14:07 ` pinskia at gcc dot gnu dot org
@ 2006-07-24 17:03 ` vz-gcc at zeitlins dot org
  2006-07-24 17:16 ` pluto at agmk dot net
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: vz-gcc at zeitlins dot org @ 2006-07-24 17:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from vz-gcc at zeitlins dot org  2006-07-24 17:02 -------
I'd like to (probably uselessly but still) argue for reopening this bug and
removing this warning. The interpretation of the standard text is open to
questions: IMHO an "A *" pointer is a pointer to void, too, as any pointer in C
is, implicitely, pointer to void. But most importantly I think this warning is
absolutely useless and the only way to get rid of it is ugly (you need an
explicit cast to "void *").

But, again, the most important argument against this warning is that it's 100%
useless. Conversion of any pointer to "void *" is well defined and unambiguous
(even in presence of multiple inheritance) and there is just no situation
whatsoever in which this warning can indicate a real problem. Please consider
suppressing it, thanks in advance!


-- 

vz-gcc at zeitlins dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vz-gcc at zeitlins dot org


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


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
                   ` (3 preceding siblings ...)
  2006-07-24 17:03 ` vz-gcc at zeitlins dot org
@ 2006-07-24 17:16 ` pluto at agmk dot net
  2006-12-08  4:37 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: pluto at agmk dot net @ 2006-07-24 17:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pluto at agmk dot net  2006-07-24 17:16 -------
*** Bug 28459 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
                   ` (4 preceding siblings ...)
  2006-07-24 17:16 ` pluto at agmk dot net
@ 2006-12-08  4:37 ` pinskia at gcc dot gnu dot org
  2006-12-08 11:08 ` vz-gcc at zeitlins dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-12-08  4:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2006-12-08 04:37 -------
> I'd like to (probably uselessly but still) argue for reopening this bug and
> removing this warning. The interpretation of the standard text is open to
> questions: IMHO an "A *" pointer is a pointer to void, too, as any pointer in C
> is, implicitely, pointer to void. But most importantly I think this warning is
> absolutely useless and the only way to get rid of it is ugly (you need an
> explicit cast to "void *").

Except IIRC a target could have void* pass different from a char* when it comes
to var-args so really the warning is still correct.


-- 


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


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
                   ` (5 preceding siblings ...)
  2006-12-08  4:37 ` pinskia at gcc dot gnu dot org
@ 2006-12-08 11:08 ` vz-gcc at zeitlins dot org
  2006-12-08 18:17   ` Andrew Pinski
  2006-12-08 18:18 ` pinskia at gmail dot com
  2009-02-10 22:23 ` jason dot orendorff at gmail dot com
  8 siblings, 1 reply; 11+ messages in thread
From: vz-gcc at zeitlins dot org @ 2006-12-08 11:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from vz-gcc at zeitlins dot org  2006-12-08 11:07 -------
Just for my personal education, could you please tell which target(s) pass
"char *" differently from "void *" in this context?

Thanks!


-- 


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


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

* Re: [Bug c/26542] bogus diagnostic with -pedantic?: format '%p';  expects type 'void*', but argument 2 has type 'A*'
  2006-12-08 11:08 ` vz-gcc at zeitlins dot org
@ 2006-12-08 18:17   ` Andrew Pinski
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Pinski @ 2006-12-08 18:17 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs

On Fri, 2006-12-08 at 11:07 +0000, vz-gcc at zeitlins dot org wrote:
> Just for my personal education, could you please tell which target(s)
> pass
> "char *" differently from "void *" in this context? 

A made up target (at least for now). :)


-- Pinski


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
                   ` (6 preceding siblings ...)
  2006-12-08 11:08 ` vz-gcc at zeitlins dot org
@ 2006-12-08 18:18 ` pinskia at gmail dot com
  2009-02-10 22:23 ` jason dot orendorff at gmail dot com
  8 siblings, 0 replies; 11+ messages in thread
From: pinskia at gmail dot com @ 2006-12-08 18:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gmail dot com  2006-12-08 18:17 -------
Subject: Re:  bogus diagnostic with -pedantic?: format '%p';
        expects type 'void*', but argument 2 has type 'A*'

On Fri, 2006-12-08 at 11:07 +0000, vz-gcc at zeitlins dot org wrote:
> Just for my personal education, could you please tell which target(s)
> pass
> "char *" differently from "void *" in this context? 

A made up target (at least for now). :)


-- Pinski


-- 


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


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

* [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*'
  2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
                   ` (7 preceding siblings ...)
  2006-12-08 18:18 ` pinskia at gmail dot com
@ 2009-02-10 22:23 ` jason dot orendorff at gmail dot com
  8 siblings, 0 replies; 11+ messages in thread
From: jason dot orendorff at gmail dot com @ 2009-02-10 22:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jason dot orendorff at gmail dot com  2009-02-10 22:22 -------
Please consider reopening this bug.

I appreciate that the relevant standards don't guarantee this idiom will always
work.  On the other hand, this warning is in practice only a nuisance.  Balance
the real work this makes for people who try to keep their code pedantic-clean
against the risk that someday an architecture will come along where it matters.

Could we maybe delete this warning just until we have some reason to believe
that such an architecture is likely to exist someday, and then reinstate it?


-- 

jason dot orendorff at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason dot orendorff at gmail
                   |                            |dot com


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


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

end of thread, other threads:[~2009-02-10 22:23 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-03  9:50 [Bug c/26542] New: bogus diagnostic with -pedantic?: format &#8216;%p&#8217; expects type &#8216;void*&#8217;, but argument 2 has type &#8216;A*&#8217; pluto at agmk dot net
2006-03-03 11:50 ` [Bug c/26542] bogus diagnostic with -pedantic?: format '%p'; expects type 'void*', but argument 2 has type 'A*' rguenth at gcc dot gnu dot org
2006-03-03 12:45 ` pinskia at gcc dot gnu dot org
2006-03-03 14:07 ` pinskia at gcc dot gnu dot org
2006-07-24 17:03 ` vz-gcc at zeitlins dot org
2006-07-24 17:16 ` pluto at agmk dot net
2006-12-08  4:37 ` pinskia at gcc dot gnu dot org
2006-12-08 11:08 ` vz-gcc at zeitlins dot org
2006-12-08 18:17   ` Andrew Pinski
2006-12-08 18:18 ` pinskia at gmail dot com
2009-02-10 22:23 ` jason dot orendorff at gmail 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).