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]

GCC 2.95.1 Bug Report


To whom it concerns,

I recently updgraded from DJGPP GCC v2.7.2 to DJGPP GCC v2.95.1 and noticed
a new warning that I believe to be incorrect.

The compiler appears to be complaining about decreasing pointer capability
across a function call.  However, the compiler does not issue it
consistently.  There are two examples that illustrate this point below.
Note the warning goes away if the const keyword is removed from foo1 or
added to the declaration of bar1.

The compiler command line is as follows:

gcc -c main.c

The compiler message is as follows:

main.c: In function `main':
main.c:12: warning: passing arg 1 of `foo1' from incompatible pointer type

The source code for main.c is as follows:

#include <stdlib.h>

static void foo1 (const unsigned char bar[4][3]);
static void foo2 (const unsigned char bar[4]);

int
main (void)
{
  unsigned char bar1[4][3];
  unsigned char bar2[4];

  foo1 (bar1);

  foo2 (bar2);

  return EXIT_SUCCESS;
}

static void
foo1 (const unsigned char bar[4][3])
{
}

static void
foo2 (const unsigned char bar[4])
{
}

-- Mike Conner, Software Engineer
-- Visteon Driver Information Core Engineering
-- Phone: 313.845.4371 Fax: 313.337.1278
-- mailto:mconner3@visteon.com (Visteon business only)
-- mailto:mconner@acm.org (all other business)


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