public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24727]  New: type "const void *" produces a warning when promoting to "void *"
@ 2005-11-07 23:37 joshudson at gmail dot com
  2005-11-08  0:07 ` [Bug c/24727] " schwab at suse dot de
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: joshudson at gmail dot com @ 2005-11-07 23:37 UTC (permalink / raw)
  To: gcc-bugs

Tried this on two machines:

SunOS hornet 5.10 Generic sun4u sparc SUNW,Ultra-4
    with GCC 4.0.1
Linux numenor 2.6.13 #9 Mon Sep 19 19:03:35 PDT 2005 i686 unknown unknown
GNU/Linux
    with GCC 3.3.6

The following code produces spurios warning:
/* Cut here */
int x_read(int h, void *buf, unsigned len);
int x_write(int h, const void *buf, unsigned len);

typedef int (*x_io)(int h, void *buf, unsigned len);
int blockio(int h, long long offset, void *buf, x_io action);

int bug(int h, unsigned where, void *buf)
{
        return blockio(h, (long long)where << 10, buf, x_write);
}
/* Cut here */
sample.c: In function `bug':
sample.c:9: warning: passing arg 4 of `blockio' from incompatible pointer type


-- 
           Summary: type "const void *" produces a warning when promoting to
                    "void *"
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joshudson at gmail dot com
  GCC host triplet: Multiple


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


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

* [Bug c/24727] type "const void *" produces a warning when promoting to "void *"
  2005-11-07 23:37 [Bug c/24727] New: type "const void *" produces a warning when promoting to "void *" joshudson at gmail dot com
@ 2005-11-08  0:07 ` schwab at suse dot de
  2005-11-08  4:25 ` joshudson at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: schwab at suse dot de @ 2005-11-08  0:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from schwab at suse dot de  2005-11-08 00:07 -------
The warning is correct.  The type of x_write is incompatible with x_io, because
"const void *" is incompatible with "void *".  Argument promotion does not come
into play here.


-- 

schwab at suse dot de changed:

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


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


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

* [Bug c/24727] type "const void *" produces a warning when promoting to "void *"
  2005-11-07 23:37 [Bug c/24727] New: type "const void *" produces a warning when promoting to "void *" joshudson at gmail dot com
  2005-11-08  0:07 ` [Bug c/24727] " schwab at suse dot de
@ 2005-11-08  4:25 ` joshudson at gmail dot com
  2005-11-08  4:34 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: joshudson at gmail dot com @ 2005-11-08  4:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from joshudson at gmail dot com  2005-11-08 04:25 -------
Aren't function arguments contravariant rather than covariant?


-- 

joshudson at gmail dot com changed:

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


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


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

* [Bug c/24727] type "const void *" produces a warning when promoting to "void *"
  2005-11-07 23:37 [Bug c/24727] New: type "const void *" produces a warning when promoting to "void *" joshudson at gmail dot com
  2005-11-08  0:07 ` [Bug c/24727] " schwab at suse dot de
  2005-11-08  4:25 ` joshudson at gmail dot com
@ 2005-11-08  4:34 ` pinskia at gcc dot gnu dot org
  2005-12-07 17:08 ` pinskia at gcc dot gnu dot org
  2005-12-07 17:09 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-08  4:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2005-11-08 04:34 -------
No, in C, these are two different function types.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c/24727] type "const void *" produces a warning when promoting to "void *"
  2005-11-07 23:37 [Bug c/24727] New: type "const void *" produces a warning when promoting to "void *" joshudson at gmail dot com
                   ` (2 preceding siblings ...)
  2005-11-08  4:34 ` pinskia at gcc dot gnu dot org
@ 2005-12-07 17:08 ` pinskia at gcc dot gnu dot org
  2005-12-07 17:09 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-07 17:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2005-12-07 17:08 -------
Reoepening to ...


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c/24727] type "const void *" produces a warning when promoting to "void *"
  2005-11-07 23:37 [Bug c/24727] New: type "const void *" produces a warning when promoting to "void *" joshudson at gmail dot com
                   ` (3 preceding siblings ...)
  2005-12-07 17:08 ` pinskia at gcc dot gnu dot org
@ 2005-12-07 17:09 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-12-07 17:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2005-12-07 17:09 -------
To Close as a dup of bug 16895.

*** This bug has been marked as a duplicate of 16895 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2005-12-07 17:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-07 23:37 [Bug c/24727] New: type "const void *" produces a warning when promoting to "void *" joshudson at gmail dot com
2005-11-08  0:07 ` [Bug c/24727] " schwab at suse dot de
2005-11-08  4:25 ` joshudson at gmail dot com
2005-11-08  4:34 ` pinskia at gcc dot gnu dot org
2005-12-07 17:08 ` pinskia at gcc dot gnu dot org
2005-12-07 17:09 ` pinskia 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).