Just for the record, this really seems to be a gcc bug, I can not
explain this otherwise:
$ cat test.c
#include <stdio.h>
static void test(void *p)
{
char *v = p;
puts(v);
}
int main(void)
{
const char foo[] = "foo";
test((void *)foo);
return 0;
}
$ gcc -Wall test.c -o test
$ gcc -Wall -O test.c -o test
test.c: In function 'main':
test.c:12: warning: passing argument 1 of 'test' discards qualifiers from pointer target type
$ gcc -Wall -O -fno-inline test.c -o test
$
gcc is version 4.2.2.
Hannes
--