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/24727] New: type "const void *" produces a warning when promoting to "void *"


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


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